luxos.api.cli#
Luxos comes with a convenient cli interface generator, similar to what click provides, but simplified for easier usage. It uses argparse underneath, and this is the simplest usage:
import luxos.cli.v1 as cli
@cli.cli()
def main():
print("Hello")
if __name__ == "__main__"
main()
!!! note
The tool is in the module luxos.cli.v1
, and the v1
denotes the first iteration of it. In future there
might be more versions to accomodate different scenarios.
What the cli package can do for you#
In the v1
version the cli provides some standard flags common to all script leveraging it. By default it provides:
-v|--verbose
and-q|--quiet
flags to increase (decrease) the logging verbosity level (see example 1)-c/--config
flag to point to a config file path (default to config.yaml, configurable as in example 3)
In the design intentions the goal is to provide an easy and fast way to start writing a script, providing support for extension, using only the internal python standard library and generally being simple.
There are escape hatches to configure the cli to suit most use cases.
Starting#
The best way to familiarize with it is to following simple examples: