Home | Trees | Indices | Help |
|
---|
|
object --+ | Options
Class representing command-line options for the cback script.
The Options
class is a Python object representation of
the command-line options of the cback script.
The object representation is two-way: a command line string or a list
of command line arguments can be used to create an Options
object, and then changes to the object can be propogated back to a list
of command-line arguments or to a command-line string. An
Options
object can even be created from scratch
programmatically (if you have a need for that).
There are two main levels of validation in the Options
class. The first is field-level validation. Field-level validation
comes into play when a given field in an object is assigned to or
updated. We use Python's property
functionality to enforce
specific validations on field values, and in some places we even use
customized list classes to enforce validations on list members. You
should expect to catch a ValueError
exception when making
assignments to fields if you are programmatically filling an object.
The second level of validation is post-completion validation. Certain validations don't make sense until an object representation of options is fully "complete". We don't want these validations to apply all of the time, because it would make building up a valid object from scratch a real pain. For instance, we might have to do things in the right order to keep from throwing exceptions, etc.
All of these post-completion validations are encapsulated in the Options.validate method. This method can be called at
any time by a client, and will always be called immediately after
creating a Options
object from a command line and before
exporting a Options
object back to a command line. This
way, we get acceptable ease-of-use but we also don't accept or emit
invalid command lines.
Note: Lists within this class are "unordered" for equality comparisons.
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from |
|
|||
help Command-line help ( -h,--help ) flag.
|
|||
version Command-line version ( -V,--version ) flag.
|
|||
verbose Command-line verbose ( -b,--verbose ) flag.
|
|||
quiet Command-line quiet ( -q,--quiet ) flag.
|
|||
config Command-line configuration file ( -c,--config ) parameter.
|
|||
full Command-line full-backup ( -f,--full ) flag.
|
|||
managed Command-line managed ( -M,--managed ) flag.
|
|||
managedOnly Command-line managed-only ( -N,--managed-only ) flag.
|
|||
logfile Command-line logfile ( -l,--logfile ) parameter.
|
|||
owner Command-line owner ( -o,--owner ) parameter, as tuple
(user,group) .
|
|||
mode Command-line mode ( -m,--mode ) parameter.
|
|||
output Command-line output ( -O,--output ) flag.
|
|||
debug Command-line debug ( -d,--debug ) flag.
|
|||
stacktrace Command-line stacktrace ( -s,--stack ) flag.
|
|||
diagnostics Command-line diagnostics ( -D,--diagnostics ) flag.
|
|||
actions Command-line actions list. |
|||
Inherited from |
|
Initializes an options object. If you initialize the object without passing either
No reference to the original arguments is saved off by this class. Once the data has been parsed (successfully or not) this original information is discarded. The argument list is assumed to be a list of arguments, not including
the name of the command, something like The argument string will be parsed into an argument list by the util.splitCommandLine function (see the documentation
for that function for some important notes about its limitations). There
is an assumption that the resulting list will be equivalent to
Unless the
|
Official string representation for class instance.
|
Informal string representation for class instance.
|
Definition of equals operator for this class. Lists within this class are "unordered" for equality comparisons.
|
Property target used to set the help flag. No validations, but we
normalize the value to |
Property target used to set the version flag. No validations, but we
normalize the value to |
Property target used to set the verbose flag. No validations, but we
normalize the value to |
Property target used to set the quiet flag. No validations, but we
normalize the value to |
Property target used to set the full flag. No validations, but we
normalize the value to |
Property target used to set the managed flag. No validations, but we
normalize the value to |
Property target used to set the managedOnly flag. No validations, but
we normalize the value to |
Property target used to set the logfile parameter.
|
Property target used to set the owner parameter. If not
|
Property target used to get the owner parameter. The parameter is a
tuple of |
Property target used to set the output flag. No validations, but we
normalize the value to |
Property target used to set the debug flag. No validations, but we
normalize the value to |
Property target used to set the stacktrace flag. No validations, but
we normalize the value to |
Property target used to set the diagnostics flag. No validations, but
we normalize the value to |
Property target used to set the actions list. We don't restrict the contents of actions. They're validated somewhere else.
|
Validates command-line options represented by the object. Unless
|
Extracts options into a list of command line arguments. The original order of the various arguments (if, indeed, the object
was initialized with a command-line) is not preserved in this generated
argument list. Besides that, the argument list is normalized to use the
long option names (i.e. --version rather than -V). The resulting list
will be suitable for passing back to the constructor in the
Unless the
Note:
It is strongly suggested that the |
Extracts options into a string of command-line arguments. The original order of the various arguments (if, indeed, the object
was initialized with a command-line) is not preserved in this generated
argument string. Besides that, the argument string is normalized to use
the long option names (i.e. --version rather than -V) and to quote all
string arguments with double quotes ( Unless the
Note:
It is strongly suggested that the |
Internal method to parse a list of command-line arguments. Most of the validation we do here has to do with whether the arguments can be parsed and whether any values which exist are valid. We don't do any validation as to whether required elements exist or whether elements exist in the proper combination (instead, that's the job of the validate method). For any of the options which supply parameters, if the option is
duplicated with long and short switches (i.e.
|
|
helpCommand-line help ( |
versionCommand-line version (
|
verboseCommand-line verbose (
|
quietCommand-line quiet ( |
configCommand-line configuration file (
|
fullCommand-line full-backup ( |
managedCommand-line managed (
|
managedOnlyCommand-line managed-only (
|
logfileCommand-line logfile (
|
ownerCommand-line owner ( |
modeCommand-line mode ( |
outputCommand-line output (
|
debugCommand-line debug ( |
stacktraceCommand-line stacktrace (
|
diagnosticsCommand-line diagnostics (
|
actionsCommand-line actions list.
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Tue Oct 19 20:56:42 2010 | http://epydoc.sourceforge.net |