changeset 3881:6b21a93da5bc beta

Explicitly tell fileinput that we use '-' as read source - minor docs improvements
author Marcin Kuzminski <marcin@python-works.com>
date Mon, 20 May 2013 14:35:42 +0200
parents a228a33d868e
children 2c5ceb546234
files rhodecode/bin/rhodecode_gist.py
diffstat 1 files changed, 11 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/bin/rhodecode_gist.py	Mon May 20 13:04:34 2013 +0200
+++ b/rhodecode/bin/rhodecode_gist.py	Mon May 20 14:35:42 2013 +0200
@@ -36,7 +36,7 @@
 def argparser(argv):
     usage = (
       "rhodecode-gist [-h] [--format=FORMAT] [--apikey=APIKEY] [--apihost=APIHOST] "
-      "[--config=CONFIG] [--save-config] "
+      "[--config=CONFIG] [--save-config] [GIST OPTIONS] "
       "[filename or stdin use - for terminal stdin ]\n"
       "Create config file: rhodecode-gist --apikey=<key> --apihost=http://rhodecode.server --save-config"
     )
@@ -48,20 +48,22 @@
     group = parser.add_argument_group('config')
     group.add_argument('--apikey', help='api access key')
     group.add_argument('--apihost', help='api host')
-    group.add_argument('--config', help='config file')
+    group.add_argument('--config', help='config file path DEFAULT: ~/.rhodecode')
     group.add_argument('--save-config', action='store_true',
                        help='save the given config into a file')
 
     group = parser.add_argument_group('GIST')
-    group.add_argument('-f', '--filename', help='set uploaded gist filename')
     group.add_argument('-p', '--private', action='store_true',
-                       help='Create private Gist')
+                       help='create private Gist')
+    group.add_argument('-f', '--filename',
+                       help='set uploaded gist filename, '
+                            'also defines syntax highlighting')
     group.add_argument('-d', '--description', help='Gist description')
     group.add_argument('-l', '--lifetime', metavar='MINUTES',
-                       help='Gist lifetime in minutes, -1 (Default) is forever')
+                       help='gist lifetime in minutes, -1 (DEFAULT) is forever')
     group.add_argument('--format', dest='format', type=str,
-            help='output format default: `%s` can '
-                 'be also `%s`' % (FORMAT_PRETTY, FORMAT_JSON),
+                       help='output format DEFAULT: `%s` can '
+                       'be also `%s`' % (FORMAT_PRETTY, FORMAT_JSON),
             default=FORMAT_PRETTY
     )
     args, other = parser.parse_known_args()
@@ -97,7 +99,7 @@
         if filename == '-':
             filename = DEFAULT_FILENAME
             gist_content = ''
-            for line in fileinput.input():
+            for line in fileinput.input('-'):
                 gist_content += line
         else:
             with open(filename, 'rb') as f:
@@ -160,6 +162,7 @@
     try:
         return _run(argv)
     except Exception, e:
+        raise
         print e
         return 1