Package common :: Module clcommands :: Class Command
[frames] | no frames]

Class Command

source code

logilab.common.configuration.Configuration --+
                                             |
                                            Command

Base class for command line commands.

Class attributes:

* `name`, the name of the command

* `min_args`, minimum number of arguments, None if unspecified

* `max_args`, maximum number of arguments, None if unspecified

* `arguments`, string describing arguments, used in command usage

* `hidden`, boolean flag telling if the command should be hidden, e.g. does
  not appear in help's commands list

* `options`, options list, as allowed by :mod:configuration

Instance Methods
 
__init__(self, logger) source code
 
check_args(self, args)
check command's arguments are provided
source code
 
main_run(self, args, rcfile=None)
Run the command and return status 0 if everything went fine.
source code
 
run(self, args)
run the command with its specific arguments
source code
Class Methods
 
description(cls) source code
 
short_description(cls) source code
Class Variables
  arguments = ''
  name = ''
  hidden = False
  min_args = None
hash(x)
  max_args = None
hash(x)
Method Details

main_run(self, args, rcfile=None)

source code 
Run the command and return status 0 if everything went fine.

If :exc:`CommandError` is raised by the underlying command, simply log
the error and return status 2.

Any other exceptions, including :exc:`BadCommandUsage` will be
propagated.