
Security News
Bun 1.2.19 Adds Isolated Installs for Better Monorepo Support
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.
.. image:: https://travis-ci.org/moskytw/clime.png :target: https://travis-ci.org/moskytw/clime
.. image:: https://pypip.in/v/clime/badge.png :target: https://pypi.python.org/pypi/clime
.. image:: https://pypip.in/d/clime/badge.png :target: https://pypi.python.org/pypi/clime
The full version of this documentaion is at clime.mosky.tw <http://clime.mosky.tw>
_.
Clime lets you convert any module into a multi-command CLI program with zero configuration.
The main features:
It is a better choice than the heavy optparse or argparse for most of the CLI tasks.
Let me show you Clime with an example.
We have a simple script with a docstring here: ::
# file: repeat.py
def repeat(message, times=2, count=False):
'''It repeats the message.
options:
-m=<str>, --message=<str> The description of this option.
-t=<int>, --times=<int>
-c, --count
'''
s = message * times
return len(s) if count else s
After we add this line: ::
import clime.now
Our CLI program is ready! ::
$ python repeat.py twice
twicetwice
$ python repeat.py --times=3 thrice
thricethricethrice
It also generates a pretty usage for this script: ::
$ python repeat.py --help
usage: [-t <int> | --times=<int>] [-c | --count] <message>
or: repeat [-t <int> | --times=<int>] [-c | --count] <message>
If you have a docstring in your function, it also shows up in usage manual with
--help
. ::
$ python repeat.py repeat --help
usage: [-t <int> | --times=<int>] [-c | --count] <message>
or: repeat [-t <int> | --times=<int>] [-c | --count] <message>
It repeats the message.
options:
-m=<str>, --message=<str> The message.
-t=<int>, --times=<int>
-c, --count
You can find more examples in the clime/examples
_.
Command <http://clime.mosky.tw/api.html#clime.core.Command>
_ describes more
about how it works.
.. _clime/examples
:
https://github.com/moskytw/clime/tree/master/examples
Clime is hosted on two different platforms, PyPI_ and GitHub_.
Install from PyPI
Install Clime from PyPI_ for a stable version: ::
$ sudo pip install clime
If you don't have pip, execute ::
$ sudo apt-get install python-pip
to install pip on Debian-base Linux distribution.
Get Clime from GitHub
If you want to follow the latest version of Clime, use ::
$ git clone git://github.com/moskytw/clime.git
to clone a Clime repository, or download manually from GitHub_.
.. _GitHub: http://github.com/moskytw/clime
.. _PyPI: http://pypi.python.org/pypi/clime
FAQs
Convert functions into multi-command program breezily.
We found that clime demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.
Security News
Popular npm packages like eslint-config-prettier were compromised after a phishing attack stole a maintainer’s token, spreading malicious updates.
Security News
/Research
A phishing attack targeted developers using a typosquatted npm domain (npnjs.com) to steal credentials via fake login pages - watch out for similar scams.