image:: https://yourlabs.io/oss/cli2/badges/master/pipeline.svg
Project description
cli2: Dynamic CLI for Python 3
Expose Python functions or objects with a minimalist argument typing style, or building your own command try during runtime.
Documentation available on RTFD.
Demo
cli2 is a little library to build CLIs, which documentation is available on RTFD, but it comes with its own demo command that may as well be useful.
Initially, cli2 was supposed to just bring Python callables on the CLI without even a single line of code:
cli2 path.to.your.callable arg1 kwarg1=value
This command was implemented again in this 10th rewrite of the CLI engine extracted from Playlabs, however this implementation features something pretty funny: cli2 is a Group subclass which overrides the default Group implementation based on the first argument passed on the command line.
Basically, when you call cli2 path.to.module, it will load a Group of name path.to.module which whill load one Command per callable in path.to.module.
When you call cli2 path.to.function it will execute the function.
As a result, these two commands are strictly equivalent:
cli2 cli2.test_node example_function foo=bar cli2 cli2.test_node.example_function foo=bar
Your challenge is to understand why ;)
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
File details
Details for the file cli2-2.2.1.tar.gz
.
File metadata
- Download URL: cli2-2.2.1.tar.gz
- Upload date:
- Size: 16.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 822cba7ede430fc006caf7779f71d22e411678df0ab9c6facc2c813f81358043 |
|
MD5 | 7e1c949355051216e17e48fa2e486b3b |
|
BLAKE2b-256 | 5556f4ec451e755b54df22c6b137bbe1dbf719cc7a5c01dad87c59e2f6e84535 |