Top Level Command
The top-level command is a module with an identically named function in it. It is similar to a package as a feature, except it is a module, not a package. I.E it is a module as a feature with an identically named function in it.
Let's create sample one:
Define the command as:
destroy.py
def destroy(name: str) -> None:
"""
Destroy given name...(top-level command)
Args:
name (str): Name of project
Return: None
"""
print(f"This is a top level destroyer - {name}")
Get the help message:
$ ./awesome -h
usage: awesome [-h] {destroy,service,upload,environment} ...
positional arguments:
{destroy,service,upload,environment}
destroy Destroy given name...(top-level command) # (1)
service The service feature to handle our services # (2)
upload This is an example of module feature # (3)
environment The environment feature to handle our environments # (4)
optional arguments:
-h, --help show this help message and exit
- Top-level command from storage_X
- Package as a feature from storage_X
- Module as a feature from storage_X
- Package as a feature from storage_Y
Get the top-level command help:
$ ./awesome destroy -h
usage: awesome destroy [-h] name
positional arguments:
name Name of project
optional arguments:
-h, --help show this help message and exit
Run the top-level command:
Versioning
You can add a unique version to your top level command by adding __version__
:
Get the version information: