.. module:: clize.runner
.. autofunction:: clize.run
.. autoclass:: clize.Clize
.. autoclass:: clize.SubcommandDispatcher
.. module:: clize.parser
.. autoclass:: CliSignature :exclude-members: converter
.. autofunction:: parameter_converter
.. autofunction:: default_converter
.. autofunction:: use_class
.. autofunction:: use_mixin
.. autoclass:: CliBoundArguments :no-undoc-members:
.. autoclass:: Parameter :show-inheritance: :exclude-members: L, I, U, R
.. autoclass:: clize.parser.ParameterWithSourceEquivalent :show-inheritance:
.. autoclass:: clize.parser.HelperParameter :show-inheritance:
.. autoclass:: clize.parser.ParameterWithValue :show-inheritance:
.. autofunction:: value_converter
.. autoclass:: clize.parser.NamedParameter :show-inheritance:
.. autoclass:: clize.parser.FlagParameter :show-inheritance:
.. autoclass:: clize.parser.OptionParameter :show-inheritance:
.. autoclass:: clize.parser.IntOptionParameter :show-inheritance:
.. autoclass:: clize.parser.PositionalParameter :show-inheritance:
.. autoclass:: clize.parser.MultiParameter :show-inheritance:
.. autoclass:: clize.parser.ExtraPosArgsParameter :show-inheritance:
.. autoclass:: clize.parser.AppendArguments :show-inheritance:
.. autoclass:: clize.parser.IgnoreAllArguments :show-inheritance:
.. autoclass:: clize.parser.FallbackCommandParameter :show-inheritance:
.. autoclass:: clize.parser.AlternateCommandParameter :show-inheritance:
.. currentmodule:: None
An error to be displayed to the user.
If clize.run catches this error, the error will be printed without the associated traceback.
def main():
raise clize.UserError("an error message")
clize.run(main)
$ python usererror_example.py
usererror_example.py: an error message
You can also specify other exception classes to be caught using
clize.run's catch
argument. However exceptions not based on
~clize.UserError will not have the command name displayed.
An error related to argument parsing. If clize.run catches this error, the command's usage line will be printed.
def main(i:int):
if i < 0:
raise clize.ArgumentError("i must be positive")
clize.run(main)
$ python argumenterror_example.py -- -5
argumenterror_example.py: i must be positive
Usage: argumenterror_example.py i
.. automodule:: clize.errors :show-inheritance: :no-undoc-members: :exclude-members: UserError,ArgumentError
.. automodule:: clize.help :show-inheritance: :members: :no-undoc-members:
.. module:: clize.legacy
.. autofunction:: clize.clize
.. autofunction:: clize.make_flag