@@ -310,6 +310,8 @@ def update_cache(language=None):
310310def main ():
311311 parser = ArgumentParser (
312312 prog = "tldr" ,
313+ usage = "tldr [-u] [-p PLATFORM] [-s SOURCE] [-c] [-r] [-L LANGUAGE] " +
314+ "command" ,
313315 description = "Python command line client for tldr"
314316 )
315317 parser .add_argument (
@@ -358,32 +360,29 @@ def main():
358360 type = str ,
359361 help = 'Override the default language' )
360362
361- options , rest = parser .parse_known_args ()
363+ parser .add_argument (
364+ 'command' , type = str , nargs = '*' , help = "command to lookup"
365+ )
366+
367+ options = parser .parse_args ()
362368
363369 colorama .init (strip = options .color )
364370
365371 if options .update_cache :
366372 update_cache (language = options .language )
367373 return
368-
369- parser .add_argument (
370- 'command' , type = str , nargs = '+' , help = "command to lookup"
371- )
372-
373- if len (sys .argv ) == 1 :
374+ elif len (sys .argv ) == 1 :
374375 parser .print_help (sys .stderr )
375376 sys .exit (1 )
376377
377- rest = parser .parse_args (rest )
378-
379378 if options .render :
380- for command in rest .command :
379+ for command in options .command :
381380 if os .path .exists (command ):
382381 with open (command , encoding = 'utf-8' ) as open_file :
383382 output (open_file .read ().encode ('utf-8' ).splitlines ())
384383 else :
385384 try :
386- command = '-' .join (rest .command )
385+ command = '-' .join (options .command )
387386 result = get_page (
388387 command ,
389388 options .source ,
0 commit comments