Name | cli2 JSON |
Version |
3.0.1
JSON |
| download |
home_page | https://yourlabs.io/oss/cli2 |
Summary | image:: https://yourlabs.io/oss/cli2/badges/master/pipeline.svg |
upload_time | 2024-12-05 13:41:28 |
maintainer | None |
docs_url | None |
author | James Pic |
requires_python | >=3.6 |
license | MIT |
keywords |
cli
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
.. image:: https://yourlabs.io/oss/cli2/badges/master/pipeline.svg
:target: https://yourlabs.io/oss/cli2/pipelines
.. image:: https://codecov.io/gh/yourlabs/cli2/branch/master/graph/badge.svg
:target: https://codecov.io/gh/yourlabs/cli2
.. image:: https://img.shields.io/pypi/v/cli2.svg
:target: https://pypi.python.org/pypi/cli2
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
<https://cli2.rtfd.io>`_.
Demo
====
cli2 is a little library to build CLIs, which documentation is `available on
RTFD <https://cli2.readthedocs.io/en/latest/>`_, but it comes with its own demo
command that may as well be useful to explore Python libraries and call
functions on the fly.
Because, 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 three commands are strictly equivalent::
cli2 cli2.test_node.example_function foo=bar
cli2 cli2.test_node example_function foo=bar
That is because cli2 generates a group with every member of the previous group!
See for yourself with::
cli2 help cli2.test_node
Or just::
cli2 cli2.test_node
Because cli2.test_node is not a callable but a module, cli2's cli2 CLI created
a command Group on the fly with the module and added every callable member as
command.
When you call a group on the command line, it displays help by default to drive
the user.
Raw data
{
"_id": null,
"home_page": "https://yourlabs.io/oss/cli2",
"name": "cli2",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "cli",
"author": "James Pic",
"author_email": "jamespic@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/6c/49/12a2aa9832c27d1e79e2cc5c12f8ab3a1e0365a5088106b43140f052a2d8/cli2-3.0.1.tar.gz",
"platform": null,
"description": ".. image:: https://yourlabs.io/oss/cli2/badges/master/pipeline.svg\n :target: https://yourlabs.io/oss/cli2/pipelines\n.. image:: https://codecov.io/gh/yourlabs/cli2/branch/master/graph/badge.svg\n :target: https://codecov.io/gh/yourlabs/cli2\n.. image:: https://img.shields.io/pypi/v/cli2.svg\n :target: https://pypi.python.org/pypi/cli2\n\ncli2: Dynamic CLI for Python 3\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nExpose Python functions or objects with a minimalist argument typing style, or\nbuilding your own command try during runtime.\n\n`Documentation available on RTFD\n<https://cli2.rtfd.io>`_.\n\nDemo\n====\n\ncli2 is a little library to build CLIs, which documentation is `available on\nRTFD <https://cli2.readthedocs.io/en/latest/>`_, but it comes with its own demo\ncommand that may as well be useful to explore Python libraries and call\nfunctions on the fly.\n\nBecause, initially, cli2 was supposed to just bring Python callables on the CLI\nwithout even a single line of code::\n\n cli2 path.to.your.callable arg1 kwarg1=value\n\nThis command was implemented again in this 10th rewrite of the CLI engine\nextracted from Playlabs, however this implementation features something pretty\nfunny: cli2 is a Group subclass which overrides the default Group\nimplementation based on the first argument passed on the command line.\n\nBasically, when you call ``cli2 path.to.module``, it will load a Group of name\n``path.to.module`` which whill load one Command per callable in\n``path.to.module``.\n\nWhen you call ``cli2 path.to.function`` it will execute the function.\n\nAs a result, these three commands are strictly equivalent::\n\n cli2 cli2.test_node.example_function foo=bar\n cli2 cli2.test_node example_function foo=bar\n\nThat is because cli2 generates a group with every member of the previous group!\n\nSee for yourself with::\n\n cli2 help cli2.test_node\n\nOr just::\n\n cli2 cli2.test_node\n\nBecause cli2.test_node is not a callable but a module, cli2's cli2 CLI created\na command Group on the fly with the module and added every callable member as\ncommand.\n\nWhen you call a group on the command line, it displays help by default to drive\nthe user.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "image:: https://yourlabs.io/oss/cli2/badges/master/pipeline.svg",
"version": "3.0.1",
"project_urls": {
"Homepage": "https://yourlabs.io/oss/cli2"
},
"split_keywords": [
"cli"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6c4912a2aa9832c27d1e79e2cc5c12f8ab3a1e0365a5088106b43140f052a2d8",
"md5": "b122437148a1dca300261e846cf0e265",
"sha256": "d57fd6064c2b3bf68fd7731859dbc6c36d08498c1325105fa0f8784b9055daa6"
},
"downloads": -1,
"filename": "cli2-3.0.1.tar.gz",
"has_sig": false,
"md5_digest": "b122437148a1dca300261e846cf0e265",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 23795,
"upload_time": "2024-12-05T13:41:28",
"upload_time_iso_8601": "2024-12-05T13:41:28.586968Z",
"url": "https://files.pythonhosted.org/packages/6c/49/12a2aa9832c27d1e79e2cc5c12f8ab3a1e0365a5088106b43140f052a2d8/cli2-3.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-05 13:41:28",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "cli2"
}