Skip to main content

commandparse

Module to parse command based CLI application.

Usage:

  • Subclass the Command class
  • Add a method with a name such as prefix_commandname with kwargs as required argument
  • Create an ArgumentParser instance
  • Call the Subclass.add_suparsers with the ArgumentParser instance and other settings
  • Use the dispatch_command function with the args returned by parser.parse_args()
parser = ArgumentParser(...)
[...]
Subclass.add_subparsers(parser, prefixes=["get_", "do_", ...], title="commands", description="available commands")

cmd = Subclass(...)
cmd.dispatch_command(commands, args)

See example.py for a more complete example. For a real world application using this lib, see: https://github.com/franc-pentest/ldeep

Release files for commandparse 1.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for commandparse 1.1.2
File Size Uploaded
commandparse-1.1.2.tar.gz 5.4 kB Details

Release files / commandparse-1.1.2.tar.gz

Download URL commandparse-1.1.2.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
4bd7bdd01b52eaa32316d6149a00b4c3820a40ff2ad62476b46aaae65dbe9faa
BLAKE2b-256 checksum
How to use checksums
796b6f1879101e405e2a5c7d352b340bc97d1936f8d54a8934ae32aac1828e50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release history Release notifications | RSS feed

This release

1.1.2 This release

1 release file

1.1.1

1 release file

1.1.0

1 release file

1.0.9

1 release file

1.0.8

1 release file

1.0.7

1 release file

1.0.6

1 release file

1.0.5

1 release file

1.0.4

1 release file

1.0.3

1 release file

1.0.2

1 release file

1.0.1

1 release file

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page