# HG changeset patch # User Marcin Kuzminski # Date 2013-05-20 12:35:42 # Node ID 6b21a93da5bc1252bd7117986489bc799ef34f8c # Parent a228a33d868e7deb7c267e00f58d27c8e0d73f15 Explicitly tell fileinput that we use '-' as read source - minor docs improvements diff --git a/rhodecode/bin/rhodecode_gist.py b/rhodecode/bin/rhodecode_gist.py --- a/rhodecode/bin/rhodecode_gist.py +++ b/rhodecode/bin/rhodecode_gist.py @@ -36,7 +36,7 @@ from rhodecode.bin.base import json, api 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= --apihost=http://rhodecode.server --save-config" ) @@ -48,20 +48,22 @@ def argparser(argv): 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 @@ def _run(argv): 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 @@ def main(argv=None): try: return _run(argv) except Exception, e: + raise print e return 1