Platitudes
The easiest way to create CLI applications.
Platitudes
instances collect several CLI commands under a single application.
They can then be accessed by calling them using the original function name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
description |
str | None
|
The description that will be shown when we run the help for the whole application. |
None
|
__call__
Runs the CLI program.
By default we run with the arguments passed to the CLI, that is,
sys.argv
, and this is what you want 99% of the time. You can however
pass all the commands as a list of strings, this is the mechanims used
internally for testing the code.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
arguments |
list[str] | None
|
List of strings passed for the CLI parsing. Defaults to using |
None
|
command
Add a function to the app.
The function will be accessible from the CLI using the original's function name. It is most often used as a decorator. The decorated function is not modified in any way and therefore can be used normally within your program. This is useful when we want to build CLI out of code that we would like to reuse for building a library.