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

Class Command

source code

                        object --+            
                                 |            
 configuration.OptionsManagerMixIn --+        
                                     |        
                        object --+   |        
                                 |   |        
configuration.OptionsProviderMixIn --+        
                                     |        
      configuration.ConfigurationMixIn --+    
                                         |    
               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)
x.__init__(...) initializes x; see help(type(x)) for signature
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

Inherited from configuration.ConfigurationMixIn: __getitem__, __iter__, __setitem__, get, load_defaults, register_options

Inherited from configuration.OptionsManagerMixIn: add_help_section, add_optik_option, add_option_group, cb_set_provider_option, generate_config, generate_manpage, global_set_option, help, input_config, load_command_line_configuration, load_config_file, load_configuration, load_file_configuration, load_provider_defaults, optik_option, read_config_file, register_options_provider, reset_parsers

Inherited from configuration.OptionsProviderMixIn: all_options, get_option_def, input_option, option_attrname, option_default, option_value, options_and_values, options_by_section, set_option

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

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)

Inherited from configuration.OptionsProviderMixIn: level, option_name, options, priority

Properties

Inherited from object: __class__

Method Details

__init__(self, logger)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

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.