##// END OF EJS Templates
Fix issue #2660. Help (-h --help --help-all) and version (--version -V)...
Timothy O'Donnell -
Show More
@@ -419,13 +419,22 b' class Application(SingletonConfigurable):'
419 # it's a subcommand, and *not* a flag or class parameter
419 # it's a subcommand, and *not* a flag or class parameter
420 return self.initialize_subcommand(subc, subargv)
420 return self.initialize_subcommand(subc, subargv)
421
421
422 if '-h' in argv or '--help' in argv or '--help-all' in argv:
422 # Arguments after a '--' argument are for the script IPython may be
423 # about to run, not IPython iteslf. For arguments parsed here (help and
424 # version), we want to only search the arguments up to the first
425 # occurrence of '--', which we're calling interpreted_argv.
426 try:
427 interpreted_argv = argv[:argv.index('--')]
428 except ValueError:
429 interpreted_argv = argv
430
431 if any(x in interpreted_argv for x in ('-h', '--help-all', '--help')):
423 self.print_description()
432 self.print_description()
424 self.print_help('--help-all' in argv)
433 self.print_help('--help-all' in interpreted_argv)
425 self.print_examples()
434 self.print_examples()
426 self.exit(0)
435 self.exit(0)
427
436
428 if '--version' in argv or '-V' in argv:
437 if '--version' in interpreted_argv or '-V' in interpreted_argv:
429 self.print_version()
438 self.print_version()
430 self.exit(0)
439 self.exit(0)
431
440
General Comments 0
You need to be logged in to leave comments. Login now