mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-04 04:04:10 +00:00
docstring
This commit is contained in:
parent
a363c8de67
commit
f88061e31c
@ -107,6 +107,25 @@ def parse_options(argv, config=None):
|
|||||||
return config
|
return config
|
||||||
|
|
||||||
def parse_or_exit_with_explanation_with_config(config, argv, stdout, stderr):
|
def parse_or_exit_with_explanation_with_config(config, argv, stdout, stderr):
|
||||||
|
"""
|
||||||
|
Parse Tahoe-LAFS CLI arguments and return a configuration object if they
|
||||||
|
are valid.
|
||||||
|
|
||||||
|
If they are invalid, write an explanation to ``stdout`` and exit.
|
||||||
|
|
||||||
|
:param twisted.python.usage.Options config: An instance of the
|
||||||
|
argument-parsing class to use.
|
||||||
|
|
||||||
|
:param [str] argv: The argument list to parse, including the name of the
|
||||||
|
program being run as ``argv[0]``.
|
||||||
|
|
||||||
|
:param stdout: The file-like object to use as stdout.
|
||||||
|
:param stderr: The file-like object to use as stderr.
|
||||||
|
|
||||||
|
:raise SystemExit: If there is an argument-parsing problem.
|
||||||
|
|
||||||
|
:return: ``config``, after using it to parse the argument list.
|
||||||
|
"""
|
||||||
try:
|
try:
|
||||||
parse_options(argv[1:], config=config)
|
parse_options(argv[1:], config=config)
|
||||||
except usage.error as e:
|
except usage.error as e:
|
||||||
|
Loading…
Reference in New Issue
Block a user