##// END OF EJS Templates
Explicitly tell fileinput that we use '-' as read source...
marcink -
r3881:6b21a93d beta
parent child Browse files
Show More
@@ -36,7 +36,7 b' from rhodecode.bin.base import json, api'
36 36 def argparser(argv):
37 37 usage = (
38 38 "rhodecode-gist [-h] [--format=FORMAT] [--apikey=APIKEY] [--apihost=APIHOST] "
39 "[--config=CONFIG] [--save-config] "
39 "[--config=CONFIG] [--save-config] [GIST OPTIONS] "
40 40 "[filename or stdin use - for terminal stdin ]\n"
41 41 "Create config file: rhodecode-gist --apikey=<key> --apihost=http://rhodecode.server --save-config"
42 42 )
@@ -48,20 +48,22 b' def argparser(argv):'
48 48 group = parser.add_argument_group('config')
49 49 group.add_argument('--apikey', help='api access key')
50 50 group.add_argument('--apihost', help='api host')
51 group.add_argument('--config', help='config file')
51 group.add_argument('--config', help='config file path DEFAULT: ~/.rhodecode')
52 52 group.add_argument('--save-config', action='store_true',
53 53 help='save the given config into a file')
54 54
55 55 group = parser.add_argument_group('GIST')
56 group.add_argument('-f', '--filename', help='set uploaded gist filename')
57 56 group.add_argument('-p', '--private', action='store_true',
58 help='Create private Gist')
57 help='create private Gist')
58 group.add_argument('-f', '--filename',
59 help='set uploaded gist filename, '
60 'also defines syntax highlighting')
59 61 group.add_argument('-d', '--description', help='Gist description')
60 62 group.add_argument('-l', '--lifetime', metavar='MINUTES',
61 help='Gist lifetime in minutes, -1 (Default) is forever')
63 help='gist lifetime in minutes, -1 (DEFAULT) is forever')
62 64 group.add_argument('--format', dest='format', type=str,
63 help='output format default: `%s` can '
64 'be also `%s`' % (FORMAT_PRETTY, FORMAT_JSON),
65 help='output format DEFAULT: `%s` can '
66 'be also `%s`' % (FORMAT_PRETTY, FORMAT_JSON),
65 67 default=FORMAT_PRETTY
66 68 )
67 69 args, other = parser.parse_known_args()
@@ -97,7 +99,7 b' def _run(argv):'
97 99 if filename == '-':
98 100 filename = DEFAULT_FILENAME
99 101 gist_content = ''
100 for line in fileinput.input():
102 for line in fileinput.input('-'):
101 103 gist_content += line
102 104 else:
103 105 with open(filename, 'rb') as f:
@@ -160,6 +162,7 b' def main(argv=None):'
160 162 try:
161 163 return _run(argv)
162 164 except Exception, e:
165 raise
163 166 print e
164 167 return 1
165 168
General Comments 0
You need to be logged in to leave comments. Login now