Infrastructure for xorn
command-line scripts.
More...
Functions | |
def | argv0 |
Return the value of argv[0] . More... | |
def | invalid_arguments |
Print an argument error message to sys.stdout and exit. More... | |
def | core_version |
Print core version. More... | |
Variables | |
bugreport = xorn.config.PACKAGE_BUGREPORT | |
Email address to which users should send bug reports. More... | |
tuple | program_name = argv0() |
Name that was used to invoke the script. More... | |
tuple | program_short_name = os.path.basename(argv0()) |
Basename component of the name that was used to invoke the script. More... | |
list | args = sys.argv[1:] |
List of command arguments. More... | |
Infrastructure for xorn
command-line scripts.
This module provides some common functionality used by xorn
subcommands. It is also where the xorn
executable provides information to submodules.
A typical xorn
subcommand looks like this:
def xorn.command.argv0 | ( | ) |
Return the value of argv[0]
.
Python replaces sys.argv[0]
with an absolute path if the command was run from the search path. This function tries to compensate for this by returning just the basename if sys.argv[0]
is an absolute path.
Definition at line 65 of file command.py.
def xorn.command.core_version | ( | ) |
Print core version.
Prints an output appropriate for the --version
option of the core scripts to sys.stdout
and exits with status code 0
.
Definition at line 121 of file command.py.
def xorn.command.invalid_arguments | ( | message | ) |
Print an argument error message to sys.stdout
and exit.
This command prints an error message of the form
xorn-frobnicate: missing file operand Try `xorn frobnicate --help' for more information.
to sys.stderr
and exits with status code 1
.
Definition at line 110 of file command.py.
list xorn.command.args = sys.argv[1:] |
List of command arguments.
A list of unparsed arguments, starting with the first argument following the invocation name. If the script was run by xorn
, this is the right-hand part of argv
with all xorn
arguments and the command name stripped. Otherwise, it is the same as argv[1:]
.
Definition at line 99 of file command.py.
xorn.command.bugreport = xorn.config.PACKAGE_BUGREPORT |
Email address to which users should send bug reports.
Set this to an appropriate value for your script.
Definition at line 56 of file command.py.
tuple xorn.command.program_name = argv0() |
Name that was used to invoke the script.
If the script was run by xorn
, this is argv[0]
plus a space character plus the subcommand name. Otherwise, it is the same as argv[0]
.
Typically used in the output of --help
.
Definition at line 78 of file command.py.
tuple xorn.command.program_short_name = os.path.basename(argv0()) |
Basename component of the name that was used to invoke the script.
If the script was run by xorn
, this is the basename of the executed script, i.e., 'xorn-something'
. Otherwise, it is the same as argv[0]
, with all text up to and including the final slash (/), if any, removed.
Typically used in error messages.
Definition at line 89 of file command.py.