{"id":24991964,"url":"https://github.com/rubik/mando","last_synced_at":"2025-04-07T10:27:42.701Z","repository":{"id":12007773,"uuid":"14588237","full_name":"rubik/mando","owner":"rubik","description":"Create Python CLI apps with little to no effort at all!","archived":false,"fork":false,"pushed_at":"2024-10-20T20:49:45.000Z","size":149,"stargazers_count":63,"open_issues_count":4,"forks_count":13,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-31T09:04:40.157Z","etag":null,"topics":["cli","cli-framework","python"],"latest_commit_sha":null,"homepage":"https://mando.readthedocs.org","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rubik.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-11-21T13:28:15.000Z","updated_at":"2024-12-30T22:21:36.000Z","dependencies_parsed_at":"2025-02-28T01:15:29.931Z","dependency_job_id":"96fb2918-adc2-456a-b8bb-004dbc3517a8","html_url":"https://github.com/rubik/mando","commit_stats":{"total_commits":122,"total_committers":10,"mean_commits":12.2,"dds":"0.16393442622950816","last_synced_commit":"849117e4d00e53e56641ae8248fc0d649aaa8768"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubik%2Fmando","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubik%2Fmando/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubik%2Fmando/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubik%2Fmando/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rubik","download_url":"https://codeload.github.com/rubik/mando/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247634691,"owners_count":20970586,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","cli-framework","python"],"created_at":"2025-02-04T13:53:14.565Z","updated_at":"2025-04-07T10:27:42.668Z","avatar_url":"https://github.com/rubik.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"mando: CLI interfaces for Humans!\n=================================\n\n.. image:: https://img.shields.io/travis/rubik/mando\n    :alt: Travis-CI badge\n    :target: https://travis-ci.org/rubik/mando\n\n.. image:: https://img.shields.io/coveralls/rubik/mando\n    :alt: Coveralls badge\n    :target: https://coveralls.io/r/rubik/mando\n\n.. image:: https://img.shields.io/pypi/implementation/mando?label=%20\u0026logo=python\u0026logoColor=white\n    :alt: PyPI - Implementation\n\n.. image:: https://img.shields.io/pypi/v/mando\n    :alt: Latest release\n    :target: https://pypi.python.org/pypi/mando\n\n.. image:: https://img.shields.io/pypi/l/mando\n    :alt: PyPI - License\n    :target: https://pypi.org/project/mando/\n\n.. image:: https://img.shields.io/pypi/pyversions/mando\n    :alt: PyPI - Python Version\n    :target: https://pypi.org/project/mando/\n\n.. image:: https://img.shields.io/pypi/format/mando\n    :alt: Download format\n    :target: http://pythonwheels.com/\n\n\nmando is a wrapper around ``argparse``, and allows you to write complete CLI\napplications in seconds while maintaining all the flexibility.\n\nInstallation\n------------\n\n.. code-block:: console\n\n    $ pip install mando\n\nThe problem\n-----------\n\nWhile ``argparse`` is great for simple command line applications with only\none, default command, when you have to add multiple commands and manage them\nthings get really messy and long. But don't worry, mando comes to help!\n\nQuickstart\n----------\n\n.. code-block:: python\n\n    from mando import command, main\n\n    @command\n    def echo(text, capitalize=False):\n        '''Echo the given text.'''\n        if capitalize:\n            text = text.upper()\n        print(text)\n\n    if __name__ == '__main__':\n        main()\n\nGenerated help:\n\n.. code-block:: console\n\n    $ python example.py -h\n    usage: example.py [-h] {echo} ...\n\n    positional arguments:\n      {echo}\n        echo      Echo the given text.\n\n    optional arguments:\n      -h, --help  show this help message and exit\n\n    $ python example.py echo -h\n    usage: example.py echo [-h] [--capitalize] text\n\n    Echo the given text.\n\n    positional arguments:\n      text\n\n    optional arguments:\n      -h, --help    show this help message and exit\n      --capitalize\n\nActual usage:\n\n.. code-block:: console\n\n    $ python example.py echo spam\n    spam\n    $ python example.py echo --capitalize spam\n    SPAM\n\n\nA *real* example\n----------------\n\nSomething more complex and real-world-*ish*. The code:\n\n.. code-block:: python\n\n    from mando import command, main\n\n\n    @command\n    def push(repository, all=False, dry_run=False, force=False, thin=False):\n        '''Update remote refs along with associated objects.\n\n        :param repository: Repository to push to.\n        :param --all: Push all refs.\n        :param -n, --dry-run: Dry run.\n        :param -f, --force: Force updates.\n        :param --thin: Use thin pack.'''\n\n        print ('Pushing to {0}. All: {1}, dry run: {2}, force: {3}, thin: {4}'\n               .format(repository, all, dry_run, force, thin))\n\n\n    if __name__ == '__main__':\n        main()\n\nmando understands Sphinx-style ``:param:``'s in the docstring, so it creates\nshort options and their help for you.\n\n.. code-block:: console\n\n    $ python git.py push -h\n    usage: git.py push [-h] [--all] [-n] [-f] [--thin] repository\n\n    Update remote refs along with associated objects.\n\n    positional arguments:\n      repository     Repository to push to.\n\n    optional arguments:\n      -h, --help     show this help message and exit\n      --all          Push all refs.\n      -n, --dry-run  Dry run.\n      -f, --force    Force updates.\n      --thin         Use thin pack.\n\nLet's try it!\n\n.. code-block:: console\n\n    $ python git.py push --all myrepo\n    Pushing to myrepo. All: True, dry run: False, force: False, thin: False\n    $ python git.py push --all -f myrepo\n    Pushing to myrepo. All: True, dry run: False, force: True, thin: False\n    $ python git.py push --all -fn myrepo\n    Pushing to myrepo. All: True, dry run: True, force: True, thin: False\n    $ python git.py push --thin -fn myrepo\n    Pushing to myrepo. All: False, dry run: True, force: True, thin: True\n    $ python git.py push --thin\n    usage: git.py push [-h] [--all] [-n] [-f] [--thin] repository\n    git.py push: error: too few arguments\n\nAmazed uh? Yes, mando got the short options and the help from the docstring!\nYou can put much more in the docstring, and if that isn't enough, there's an\n``@arg`` decorator to customize the arguments that get passed to argparse.\n\n\nType annotations\n----------------\n\nmando understands Python 3-style type annotations and will warn the user if the\narguments given to a command are of the wrong type.\n\n.. code-block:: python\n\n    from mando import command, main\n\n\n    @command\n    def duplicate(string, times: int):\n        '''Duplicate text.\n\n        :param string: The text to duplicate.\n        :param times: How many times to duplicate.'''\n\n        print(string * times)\n\n\n    if __name__ == '__main__':\n        main()\n\n.. code-block:: console\n\n    $ python3 test.py duplicate \"test \" 5\n    test test test test test\n    $ python3 test.py duplicate \"test \" foo\n    usage: test.py duplicate [-h] string times\n    test.py duplicate: error: argument times: invalid int value: 'foo'\n\n\nMando has lots of other options. For example, it supports different docstring\nstyles (Sphinx, Google and NumPy), supports shell autocompletion via the\n``argcomplete`` package and supports custom format classes. For a complete\ndocumentation, visit https://mando.readthedocs.org/.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frubik%2Fmando","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frubik%2Fmando","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frubik%2Fmando/lists"}