Skip to content

Commit

Permalink
Merge pull request ipython#1465 from minrk/helpcommand
Browse files Browse the repository at this point in the history
allow `ipython help subcommand` syntax

We use git-style subcommands, and should support git-style help to match.
  • Loading branch information
minrk committed Mar 3, 2012
2 parents fa3371b + 89ab96c commit 2d3a88d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 4 additions & 0 deletions IPython/config/application.py
Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions IPython/frontend/terminal/ipapp.py
Expand Up @@ -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 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 profile -h # show the help string for the profile subcmd
ipython help profile # show the help for the profile subcmd
"""

#-----------------------------------------------------------------------------
Expand Down

0 comments on commit 2d3a88d

Please sign in to comment.