starcluster.commands.help

Package starcluster :: Package commands :: Module help |
[hide private]
[frames] | no frames]

# Source Code for Module starcluster.commands.help

     1  #!/usr/bin/env python
     2
     3  import optparse
     4
     5  from base import CmdBase
     6
     7
     8 -class CmdHelp(CmdBase):
     9      """
    10      help
    11
    12      Show StarCluster usage
    13      """
    14      names = ['help']
    15
    16 -    def execute(self, args):
    17          if args:
    18              cmdname = args[0]
    19              try:
    20                  sc = self.subcmds_map[cmdname]
    21                  lparser = optparse.OptionParser(sc.__doc__.strip())
    22                  if hasattr(sc, 'addopts'):
    23                      sc.addopts(lparser)
    24                  lparser.print_help()
    25              except KeyError:
    26                  raise SystemExit("Error: invalid command '%s'" % cmdname)
    27          else:
    28              self.gparser.parse_args(['--help'])
    29