Package flumotion :: Package extern :: Package command :: Module command
[hide private]

Module command

source code

Command class.

Classes [hide private]
  CommandHelpFormatter
I format the description as usual, but add an overview of commands after it if there are any, formatted like the options.
  CommandOptionParser
I parse options as usual, but I explicitly allow setting stdout so that our print_help() method (invoked by default with -h/--help) defaults to writing there.
  Command
I am a class that handles a command for a program.
  CommandExited
  CommandOk
  CommandError
Functions [hide private]
cmd.Cmd
commandToCmdClass(command) source code
 
commandToCmd(command) source code
Variables [hide private]
  __package__ = 'flumotion.extern.command'
Function Details [hide private]

commandToCmdClass(command)

source code 
Parameters:
  • command (Command

    Take a Command instance and create a cmd.Cmd class from it that implements a command line interpreter, using the commands under the given Command instance as its subcommands.

    Example use in a command:

    >>> def do(self, args):
    ...     cmd = command.commandToCmdClass(self)()
    ...     cmd.prompt = 'prompt> '
    ...     while not cmd.exited:
    ...         cmd.cmdloop()
    )
Returns: cmd.Cmd