No project description provided
Project description
fastcommand
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
Release history Release notifications | RSS feed
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)
Built Distribution
Close
Hashes for fastcommand-0.1.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8c1e9c149c23ee18f6e439e2bdce3a0b08a678a5e113dee6a2372e21519bfbbd |
|
MD5 | 8bfdf910e1d8751c2ad9e592f3c983e6 |
|
BLAKE2b-256 | b7f03e42a5a96a2890a7a10dbab8603f7fe3cf34925a8c8dc589ace1f44af67d |