Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Clize
.. image:: https://readthedocs.org/projects/clize/badge/?version=stable :target: http://clize.readthedocs.io/en/stable/?badge=stable :alt: Documentation Status .. image:: https://badges.gitter.im/Join%20Chat.svg :alt: Join the chat at https://gitter.im/epsy/clize :target: https://gitter.im/epsy/clize?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge .. image:: https://github.com/epsy/clize/actions/workflows/ci.yml/badge.svg?branch=master :target: https://github.com/epsy/clize/actions/workflows/ci.yml .. image:: https://coveralls.io/repos/epsy/clize/badge.svg?branch=master :target: https://coveralls.io/r/epsy/clize?branch=master
Clize is an argument parser for Python <https://www.python.org/>
_. You can
use Clize as an alternative to argparse
if you want an even easier way to
create command-line interfaces.
With Clize, you can:
clize.run
.--help
messages generated from your docstrings.Here's an example:
.. code-block:: python
from clize import run
def hello_world(name=None, *, no_capitalize=False):
"""Greets the world or the given name.
:param name: If specified, only greet this person.
:param no_capitalize: Don't capitalize the given name.
"""
if name:
if not no_capitalize:
name = name.title()
return 'Hello {0}!'.format(name)
return 'Hello world!'
if __name__ == '__main__':
run(hello_world)
The python code above can now be used on the command-line as follows:
.. code-block:: console
$ pip install clize
$ python3 hello.py --help
Usage: hello.py [OPTIONS] name
Greets the world or the given name.
Positional arguments:
name If specified, only greet this person.
Options:
--no-capitalize Don't capitalize the given name.
Other actions:
-h, --help Show the help
$ python3 hello.py
Hello world!
$ python3 hello.py john
Hello John!
$ python3 hello.py dave --no-capitalize
Hello dave!
You can find the documentation and tutorials at http://clize.readthedocs.io/
FAQs
Turn functions into command-line interfaces
We found that clize 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
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.