Package logilab :: Package common :: Module clcommands
[frames] | no frames]

Module clcommands

source code

Helper functions to support command line tools providing more than
one command.

e.g called as "tool command [options] args..." where <options> and <args> are
command'specific

Classes
  BadCommandUsage
Raised when an unknown command is used or when a command is not correctly used.
  Command
Base class for command line commands.
  ListCommandsCommand
list available commands, useful for bash completion.
Functions
 
pop_arg(args_list, expected_size_after=0, msg="Missing argument")
helper function to get and check command line arguments
source code
 
register_commands(commands)
register existing commands
source code
 
main_usage(status=0, doc=DEFAULT_DOC, copyright=DEFAULT_COPYRIGHT)
display usage for the main program (i.e.
source code
 
cmd_run(cmdname, *args) source code
 
main_run(args, doc=DEFAULT_DOC, copyright=DEFAULT_COPYRIGHT)
command line tool
source code
Variables
  DEFAULT_COPYRIGHT = '...
  DEFAULT_DOC = '...
Function Details

main_usage(status=0, doc=DEFAULT_DOC, copyright=DEFAULT_COPYRIGHT)

source code 
display usage for the main program (i.e. when no command supplied)
and exit


Variables Details

DEFAULT_COPYRIGHT

Value:
'''\
Copyright (c) 2004-2010 LOGILAB S.A. (Paris, FRANCE), all rights reser\
ved.
http://www.logilab.fr/ -- mailto:contact@logilab.fr'''

DEFAULT_DOC

Value:
'''\
Type "%prog <command> --help" for more information about a specific
command. Available commands are :\n'''