DEPRECATED BY `cli2
Project description
DEPRECATED BY `cli2
<https://pypi-hypernode.com/project/cli2/>`_
And `djcli
<https://pypi-hypernode.com/project/djcli/`_
And `yash
<https://pypi-hypernode.com/project/yash/`_
Left for posterity
clilabs: the python CLI that gets things done.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sometimes I want to execute a python callback with some args on the command
line, but i get frustrated that it always requires to wrap my command in a
wrapper of some sort. Clilabs unfrustrates me.
Install::
$ pip install clilabs
Help::
$ clilabs
clilabs automates python callables parametered calls.
Things starting with - will arrive in clilabs.context.
Examples:
clilabs help your.mod:main
clilabs debug your.mod -a --b --something='to see' how it=parses
clilabs your.mod:funcname with your=args
clilabs help clilabs.django
clilabs help django
clilabs clilabs.django:list auth.user
clilabs django:list auth.user # also works
# refer to the root one
clilabs ~django.db.models:somefunc somearg some=kwarg
Demo::
$ clilabs debug ~your.mod:yourfunc -a --b --something='to see' how it=parses
Could not import your.mod
Args: ('how',)
Kwargs: {'it': 'parses'}
Context args: ['a', 'b']
Context kwargs: {'something': 'to see'}
Moar in tutorial.md
Making your own command
~~~~~~~~~~~~~~~~~~~~~~~
Add to your setup.py::
entry_points={
'console_scripts': [
'yourcmd = yourpkg.cli:cli',
],
},
Add in yourpkg/cli.py::
'''Your documentation that shows by default:
yourcmd somefunc ...
'''
import clilabs
def cli(*argv):
argv = list(argv) if argv else ['help', 'yourpkg.cli']
cb = clilabs.modfuncimp(*clilabs.funcexpand(argv[0], 'yourpkg.cli'))
args, kwargs = clilabs.expand(*argv[1:])
return cb(*args, **kwargs)
def main(...):
'''Put your help text, that will show when the
user runs the command without argument.'''
<https://pypi-hypernode.com/project/cli2/>`_
And `djcli
<https://pypi-hypernode.com/project/djcli/`_
And `yash
<https://pypi-hypernode.com/project/yash/`_
Left for posterity
clilabs: the python CLI that gets things done.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sometimes I want to execute a python callback with some args on the command
line, but i get frustrated that it always requires to wrap my command in a
wrapper of some sort. Clilabs unfrustrates me.
Install::
$ pip install clilabs
Help::
$ clilabs
clilabs automates python callables parametered calls.
Things starting with - will arrive in clilabs.context.
Examples:
clilabs help your.mod:main
clilabs debug your.mod -a --b --something='to see' how it=parses
clilabs your.mod:funcname with your=args
clilabs help clilabs.django
clilabs help django
clilabs clilabs.django:list auth.user
clilabs django:list auth.user # also works
# refer to the root one
clilabs ~django.db.models:somefunc somearg some=kwarg
Demo::
$ clilabs debug ~your.mod:yourfunc -a --b --something='to see' how it=parses
Could not import your.mod
Args: ('how',)
Kwargs: {'it': 'parses'}
Context args: ['a', 'b']
Context kwargs: {'something': 'to see'}
Moar in tutorial.md
Making your own command
~~~~~~~~~~~~~~~~~~~~~~~
Add to your setup.py::
entry_points={
'console_scripts': [
'yourcmd = yourpkg.cli:cli',
],
},
Add in yourpkg/cli.py::
'''Your documentation that shows by default:
yourcmd somefunc ...
'''
import clilabs
def cli(*argv):
argv = list(argv) if argv else ['help', 'yourpkg.cli']
cb = clilabs.modfuncimp(*clilabs.funcexpand(argv[0], 'yourpkg.cli'))
args, kwargs = clilabs.expand(*argv[1:])
return cb(*args, **kwargs)
def main(...):
'''Put your help text, that will show when the
user runs the command without argument.'''
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
clilabs-1.0.1.dev1.tar.gz
(7.9 kB
view details)
File details
Details for the file clilabs-1.0.1.dev1.tar.gz
.
File metadata
- Download URL: clilabs-1.0.1.dev1.tar.gz
- Upload date:
- Size: 7.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.6.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f3dc6d95b978697d29314310d6149ca52f7206c0b5efc57bd736429465b0d7c |
|
MD5 | 1a763985e2af324708cb310f047de70e |
|
BLAKE2b-256 | c39b8cf5001eab6bac3a23ad3a92f0f6ee9b9491852c2667bf53dbeec565e911 |