diff options
author | Michal Minar <miminar@redhat.com> | 2013-10-11 13:01:37 +0200 |
---|---|---|
committer | Michal Minar <miminar@redhat.com> | 2013-10-11 13:27:37 +0200 |
commit | 8a8165a6e98eac88365cad60266522e8bd809b28 (patch) | |
tree | 1246bccb55e93bbc63f3891e58c78e2c84293363 /doc | |
parent | de3849421b442e7ac923608eae310b74b7cbbe95 (diff) | |
download | openlmi-scripts-8a8165a6e98eac88365cad60266522e8bd809b28.tar.gz openlmi-scripts-8a8165a6e98eac88365cad60266522e8bd809b28.tar.xz openlmi-scripts-8a8165a6e98eac88365cad60266522e8bd809b28.zip |
doc: documented new FALLBACK_COMMAND property
Diffstat (limited to 'doc')
-rw-r--r-- | doc/command-properties.rst | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/doc/command-properties.rst b/doc/command-properties.rst index 9ee18b1..d89d18a 100644 --- a/doc/command-properties.rst +++ b/doc/command-properties.rst @@ -289,6 +289,39 @@ them. class method by :py:class:`~lmi.scripts.common.command.meta.MultiplexerMetaClass`. +``FALLBACK_COMMAND`` : :py:class:`lmi.scripts.common.command.endpoint.LmiEndPointCommand` + Command class used when no command defined in ``COMMANDS`` dictionary is + passed on command line. + + Take for example this usage string: :: + + + """ + Display hardware information. + + Usage: + %(cmd)s [all] + %(cmd)s system + %(cmd)s chassis + """ + + This suggests there are tree commands defined taking care of listing + hardware informations. Entry point definition could look like this: :: + + class Hardware(command.LmiCommandMultiplexer): + OWN_USAGE = __doc__ # usage string from above + COMMANDS = { 'all' : All + , 'system' : System + , 'chassis' : Chassis + } + FALLBACK_COMMAND = All + + Without the ``FALLBACK_COMMAND`` property, the multiplexer would not + handle the case when ``'all'`` argument is omitted as is suggested in + the usage string. Adding it to command properties causes this multiplexer + to behave exactly as ``All`` subcommand in case that no command + is given on command line. + .. _lmi_lister_properties: ``LmiLister`` properties |