fire-commands
Easy to use helper library for creating google fire based CLIs
https://github.com/google/python-fire
See example application firehelper_example for usage.
CLI entry point
In the CLI entry point, import relevant CLI commands, and use start_fire_cli initialise the fire app.
import firehelper
from .commands import * #noqa
def main():
firehelper.start_fire_cli('firehelper_example')
if __name__ == '__main__':
main()
Commands
Import each command in the main app to ensure code to register the command is run.
To register commands:
print_commands = {
'print': lambda mytext: print(mytext)
}
firehelper.CommandRegistry.register(print_commands)
To register commands with subcommands:
maths_commands = {
'maths': {
'double': double,
'square': square
}
}
firehelper.CommandRegistry.register(maths_commands)
You can import all commands within a module as follows:
# commands.__init__.py
"""Ensure all commands to be registered are referenced here."""
__all__ = ['maths', 'print']
# __main__.py
from commands import * # noqa
Metadata
Release files for fire-cli-helper 0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fire-cli-helper-0.2.tar.gz | 2.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fire_cli_helper-0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.3 kB
Release files / fire-cli-helper-0.2.tar.gz
| Download URL | fire-cli-helper-0.2.tar.gz |
|---|---|
| Size | 2.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f24cd811d27503101c501e5195015646a8c41d9b2c8c7444f4b17c62bc0ac447
|
|
BLAKE2b-256 checksum How to use checksums |
be73d658a835855556f97027d97d7f34c130ca4ceb7f8acc95d08e434004723e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.1
|
Release files / fire_cli_helper-0.2-py3-none-any.whl
| Download URL | fire_cli_helper-0.2-py3-none-any.whl |
|---|---|
| Size | 8.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0d5daade4fb7933e07d18fc84191f925c0c817412bbc4bd3186135c9416c4445
|
|
BLAKE2b-256 checksum How to use checksums |
9640c73447c2d1a529812cbc167317980cb56fd912bc4c01ec1431b87654beb5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.1
|