##// END OF EJS Templates
Merge pull request #3759 from jdfreder/help_fix...
Paul Ivanov -
r11668:335e87d9 merge
parent child Browse files
Show More
@@ -88,9 +88,7 b' def catch_config_error(method, app, *args, **kwargs):'
88 try:
88 try:
89 return method(app, *args, **kwargs)
89 return method(app, *args, **kwargs)
90 except (TraitError, ArgumentError) as e:
90 except (TraitError, ArgumentError) as e:
91 app.print_description()
92 app.print_help()
91 app.print_help()
93 app.print_examples()
94 app.log.fatal("Bad config encountered during initialization:")
92 app.log.fatal("Bad config encountered during initialization:")
95 app.log.fatal(str(e))
93 app.log.fatal(str(e))
96 app.log.debug("Config at the time: %s", app.config)
94 app.log.debug("Config at the time: %s", app.config)
@@ -337,6 +335,7 b' class Application(SingletonConfigurable):'
337
335
338 If classes=False (the default), only flags and aliases are printed.
336 If classes=False (the default), only flags and aliases are printed.
339 """
337 """
338 self.print_description()
340 self.print_subcommands()
339 self.print_subcommands()
341 self.print_options()
340 self.print_options()
342
341
@@ -356,6 +355,9 b' class Application(SingletonConfigurable):'
356 print "To see all available configurables, use `--help-all`"
355 print "To see all available configurables, use `--help-all`"
357 print
356 print
358
357
358 self.print_examples()
359
360
359 def print_description(self):
361 def print_description(self):
360 """Print the application description."""
362 """Print the application description."""
361 for p in wrap_paragraphs(self.description):
363 for p in wrap_paragraphs(self.description):
@@ -475,9 +477,7 b' class Application(SingletonConfigurable):'
475 interpreted_argv = argv
477 interpreted_argv = argv
476
478
477 if any(x in interpreted_argv for x in ('-h', '--help-all', '--help')):
479 if any(x in interpreted_argv for x in ('-h', '--help-all', '--help')):
478 self.print_description()
479 self.print_help('--help-all' in interpreted_argv)
480 self.print_help('--help-all' in interpreted_argv)
480 self.print_examples()
481 self.exit(0)
481 self.exit(0)
482
482
483 if '--version' in interpreted_argv or '-V' in interpreted_argv:
483 if '--version' in interpreted_argv or '-V' in interpreted_argv:
@@ -209,24 +209,14 b' class NbConvertApp(BaseIPythonApplication):'
209 "\n\t" + "\n\t".join(get_export_names()),
209 "\n\t" + "\n\t".join(get_export_names()),
210 file=sys.stderr)
210 file=sys.stderr)
211 sys.exit(-1)
211 sys.exit(-1)
212 # except Exception as e:
213 # print("Error: could not export '%s'" % notebook_filename, file=sys.stderr)
214 # print(e, file=sys.stderr)
215 else:
212 else:
216 self.writer.write(output, resources, notebook_name=notebook_name)
213 self.writer.write(output, resources, notebook_name=notebook_name)
217 conversion_success += 1
214 conversion_success += 1
218
215
219 # If nothing was converted successfully, help the user.
216 # If nothing was converted successfully, help the user.
220 if conversion_success == 0:
217 if conversion_success == 0:
221
218 self.print_help()
222 # No notebooks were specified, show help.
219 sys.exit(-1)
223 if len(self.notebooks) == 0:
224 self.print_help()
225
226 # Notebooks were specified, but not converted successfully. Show how
227 # to access help.
228 else:
229 print('For help, use "ipython nbconvert --help"')
230
220
231
221
232 #-----------------------------------------------------------------------------
222 #-----------------------------------------------------------------------------
General Comments 0
You need to be logged in to leave comments. Login now