From dabdb1b2c9004b585c16b1f409af786bbe7168e4 Mon Sep 17 00:00:00 2001 From: MinRK Date: Fri, 2 Mar 2012 14:24:38 -0800 Subject: [PATCH 1/3] allow `ipython help subcommand` syntax Implementation-wise, simply transforms argv to `ipython subcommand -h` We use git-style subcommands, and should support git-style help to match. As requested by @jdh2358 --- IPython/config/application.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/IPython/config/application.py b/IPython/config/application.py index b10481326d6..ba26b571ede 100644 --- a/IPython/config/application.py +++ b/IPython/config/application.py @@ -404,6 +404,10 @@ def flatten_flags(self): def parse_command_line(self, argv=None): """Parse the command line arguments.""" argv = sys.argv[1:] if argv is None else argv + + if argv and argv[0] == 'help': + # turn `ipython help notebook` into `ipython notebook -h` + argv = argv[1:] + ['-h'] if self.subcommands and len(argv) > 0: # we have subcommands, and one may have been specified From 445364a05a0ddab5e40c33241c9c45a44f41df0d Mon Sep 17 00:00:00 2001 From: MinRK Date: Fri, 2 Mar 2012 14:37:37 -0800 Subject: [PATCH 2/3] mention notebook subcmd in main IPython help output also recommend `ipython help subcmd` syntax instead of `ipython subcmd -h` --- IPython/frontend/terminal/ipapp.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/IPython/frontend/terminal/ipapp.py b/IPython/frontend/terminal/ipapp.py index e13fbfc9b1b..5c8e749576b 100755 --- a/IPython/frontend/terminal/ipapp.py +++ b/IPython/frontend/terminal/ipapp.py @@ -67,13 +67,16 @@ ipython --profile=foo # start with profile foo ipython qtconsole # start the qtconsole GUI application -ipython qtconsole -h # show the help string for the qtconsole subcmd +ipython help qtconsole # show the help for the qtconsole subcmd ipython console # start the terminal-based console application -ipython console -h # show the help string for the console subcmd +ipython help console # show the help for the console subcmd ipython profile create foo # create profile foo w/ default config files -ipython profile -h # show the help string for the profile subcmd +ipython help profile # show the help for the profile subcmd + +ipython notebook # start the IPython notebook +ipython help notebook # show the help for the notebook subcmd """ #----------------------------------------------------------------------------- From 89ab96c552d735e09ed3bf1ba4cdad943db2b11f Mon Sep 17 00:00:00 2001 From: MinRK Date: Fri, 2 Mar 2012 20:10:40 -0800 Subject: [PATCH 3/3] reorder profile & notebook in ipython help --- IPython/frontend/terminal/ipapp.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/IPython/frontend/terminal/ipapp.py b/IPython/frontend/terminal/ipapp.py index 5c8e749576b..8b687720bb7 100755 --- a/IPython/frontend/terminal/ipapp.py +++ b/IPython/frontend/terminal/ipapp.py @@ -72,11 +72,11 @@ ipython console # start the terminal-based console application ipython help console # show the help for the console subcmd -ipython profile create foo # create profile foo w/ default config files -ipython help profile # show the help for the profile subcmd - ipython notebook # start the IPython notebook ipython help notebook # show the help for the notebook subcmd + +ipython profile create foo # create profile foo w/ default config files +ipython help profile # show the help for the profile subcmd """ #-----------------------------------------------------------------------------