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

Package command

source code

Command class.

Submodules [hide private]

Classes [hide private]
Command
I am a class that handles a command for a program.
CommandError
CommandExited
CommandHelpFormatter
I format the description as usual, but add an overview of commands after it if there are any, formatted like the options.
CommandOk
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.
Functions [hide private]
 
commandToCmd(command) source code
cmd.Cmd
commandToCmdClass(command) source code
Variables [hide private]
  __package__ = None
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