Skip to main content

No project description provided

Project description

fastcommand

build

Python module for defining multi-command cli programs

Description

The fastcommand module is a lightweight wrapper over argparse which aims to make it easier to write multi-command cli programs and utilities. It does so by providing convenience decorators that allow for quickly defining sub-commands.

Usage

import fastcommand


@fastcommand.command("hello", help="say hello")
def command_hello(options):
    print("Hello, World!")


@fastcommand.command("goodbye", help="say goodbye", arguments=[
    fastcommand.Argument("name"),
    fastcommand.Argument("--wave", "-w", action="store_true", default=False)
])
def command_goodbye(options):
    print(f"Goodbye, {options.name}!")
    if options.wave:
        print("👋")


def main():
    cli = fastcommand.CommandParser(description="Simple fastcommand example.")
    cli.use_logging(format="[%(levelname)s] %(message)s")
    cli.run()


if __name__ == "__main__":
    main()

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

fastcommand-0.1.8.tar.gz (3.3 kB view hashes)

Uploaded Source

Built Distribution

fastcommand-0.1.8-py3-none-any.whl (5.4 kB view hashes)

Uploaded Python 3

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