Skip to main content

No project description provided

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fire-cli-helper-0.2.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

fire_cli_helper-0.2-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file fire-cli-helper-0.2.tar.gz.

File metadata

  • Download URL: fire-cli-helper-0.2.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for fire-cli-helper-0.2.tar.gz
Algorithm Hash digest
SHA256 f24cd811d27503101c501e5195015646a8c41d9b2c8c7444f4b17c62bc0ac447
MD5 88e7051d4c67c4246bcfe8e33807747c
BLAKE2b-256 be73d658a835855556f97027d97d7f34c130ca4ceb7f8acc95d08e434004723e

See more details on using hashes here.

File details

Details for the file fire_cli_helper-0.2-py3-none-any.whl.

File metadata

  • Download URL: fire_cli_helper-0.2-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for fire_cli_helper-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0d5daade4fb7933e07d18fc84191f925c0c817412bbc4bd3186135c9416c4445
MD5 c0111786d2396853ea744df3175f1360
BLAKE2b-256 9640c73447c2d1a529812cbc167317980cb56fd912bc4c01ec1431b87654beb5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page