cli-ui


Namecli-ui JSON
Version 0.18.0 PyPI version JSON
download
home_pagehttps://git.sr.ht/~your-tools/python-cli-ui
SummaryBuild Nice User Interfaces In The Terminal
upload_time2024-12-11 13:40:11
maintainerNone
docs_urlNone
authorDimitri Merejkowsky
requires_python<4.0.0,>=3.8.1
licenseBSD-3-Clause
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            .. image:: https://img.shields.io/pypi/pyversions/cli-ui.svg
  :target: https://pypi.org/project/cli-ui

.. image:: https://img.shields.io/pypi/v/cli-ui.svg
  :target: https://pypi.org/project/cli-ui/

.. image:: https://img.shields.io/github/license/your-tools/python-cli-ui.svg
  :target: https://github.com/your-tools/python-cli-ui/blob/main/LICENSE

.. image:: https://img.shields.io/badge/deps%20scanning-pyup.io-green
  :target: https://github.com/your-tools/python-cli-ui/actions

python-cli-ui
=============

Tools for nice user interfaces in the terminal.

Note
----

This project was originally hosted on the `TankerHQ
<https://github.com/TankerHQ>`_ organization, which was my employer from 2016
to 2021. They kindly agreed to give back ownership of this project to
me. Thanks!

Documentation
-------------


See `python-cli-ui documentation <https://your-tools.github.io/python-cli-ui>`_.

Demo
----


Watch the `asciinema recording <https://asciinema.org/a/112368>`_.


Usage
-----

.. code-block:: console

    $ pip install cli-ui

Example:

.. code-block:: python

    import cli_ui

    # coloring:
    cli_ui.info(
      "This is",
      cli_ui.red, "red", cli_ui.reset,
      "and this is",
      cli_ui.bold, "bold"
    )

    # enumerating:
    list_of_things = ["foo", "bar", "baz"]
    for i, thing in enumerate(list_of_things):
        cli_ui.info_count(i, len(list_of_things), thing)

    # progress indication:
    cli_ui.info_progress("Done",  5, 20)
    cli_ui.info_progress("Done", 10, 20)
    cli_ui.info_progress("Done", 20, 20)

    # reading user input:
    with_sugar = cli_ui.ask_yes_no("With sugar?", default=False)

    fruits = ["apple", "orange", "banana"]
    selected_fruit = cli_ui.ask_choice("Choose a fruit", choices=fruits)

    #  ... and more!

Contributing
------------

We use `optimistic merging <https://dmerej.info/blog/post/optimistic-merging/>`_ so you don't have to worry too much about formatting the code, pleasing the linters or making sure all the test pass.

That being said, if you want, you can install `just <https://just.systems/man/en/>`_ and use it to check your changes automatically. Just run ``just`` to see available tasks.

Making a new release
--------------------

* Create a token on pypi : see `pypi help  <https://pypi.org/help/#apitoken>`_ for details.

* Install `tbump <https://pypi.org/project/tbump>`_ and use it to bump `cli-ui` to the new version.

Uploading documentation
-----------------------

Run:

.. code-block:: sh

    just deploy-doc


            

Raw data

            {
    "_id": null,
    "home_page": "https://git.sr.ht/~your-tools/python-cli-ui",
    "name": "cli-ui",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0.0,>=3.8.1",
    "maintainer_email": null,
    "keywords": null,
    "author": "Dimitri Merejkowsky",
    "author_email": "dimitri@dmerej.info",
    "download_url": "https://files.pythonhosted.org/packages/26/a9/b44b1048064206e9ceceffb7ce38aa2432dbf79bd13d45da8a1452a2e3db/cli_ui-0.18.0.tar.gz",
    "platform": null,
    "description": ".. image:: https://img.shields.io/pypi/pyversions/cli-ui.svg\n  :target: https://pypi.org/project/cli-ui\n\n.. image:: https://img.shields.io/pypi/v/cli-ui.svg\n  :target: https://pypi.org/project/cli-ui/\n\n.. image:: https://img.shields.io/github/license/your-tools/python-cli-ui.svg\n  :target: https://github.com/your-tools/python-cli-ui/blob/main/LICENSE\n\n.. image:: https://img.shields.io/badge/deps%20scanning-pyup.io-green\n  :target: https://github.com/your-tools/python-cli-ui/actions\n\npython-cli-ui\n=============\n\nTools for nice user interfaces in the terminal.\n\nNote\n----\n\nThis project was originally hosted on the `TankerHQ\n<https://github.com/TankerHQ>`_ organization, which was my employer from 2016\nto 2021. They kindly agreed to give back ownership of this project to\nme. Thanks!\n\nDocumentation\n-------------\n\n\nSee `python-cli-ui documentation <https://your-tools.github.io/python-cli-ui>`_.\n\nDemo\n----\n\n\nWatch the `asciinema recording <https://asciinema.org/a/112368>`_.\n\n\nUsage\n-----\n\n.. code-block:: console\n\n    $ pip install cli-ui\n\nExample:\n\n.. code-block:: python\n\n    import cli_ui\n\n    # coloring:\n    cli_ui.info(\n      \"This is\",\n      cli_ui.red, \"red\", cli_ui.reset,\n      \"and this is\",\n      cli_ui.bold, \"bold\"\n    )\n\n    # enumerating:\n    list_of_things = [\"foo\", \"bar\", \"baz\"]\n    for i, thing in enumerate(list_of_things):\n        cli_ui.info_count(i, len(list_of_things), thing)\n\n    # progress indication:\n    cli_ui.info_progress(\"Done\",  5, 20)\n    cli_ui.info_progress(\"Done\", 10, 20)\n    cli_ui.info_progress(\"Done\", 20, 20)\n\n    # reading user input:\n    with_sugar = cli_ui.ask_yes_no(\"With sugar?\", default=False)\n\n    fruits = [\"apple\", \"orange\", \"banana\"]\n    selected_fruit = cli_ui.ask_choice(\"Choose a fruit\", choices=fruits)\n\n    #  ... and more!\n\nContributing\n------------\n\nWe use `optimistic merging <https://dmerej.info/blog/post/optimistic-merging/>`_ so you don't have to worry too much about formatting the code, pleasing the linters or making sure all the test pass.\n\nThat being said, if you want, you can install `just <https://just.systems/man/en/>`_ and use it to check your changes automatically. Just run ``just`` to see available tasks.\n\nMaking a new release\n--------------------\n\n* Create a token on pypi : see `pypi help  <https://pypi.org/help/#apitoken>`_ for details.\n\n* Install `tbump <https://pypi.org/project/tbump>`_ and use it to bump `cli-ui` to the new version.\n\nUploading documentation\n-----------------------\n\nRun:\n\n.. code-block:: sh\n\n    just deploy-doc\n\n",
    "bugtrack_url": null,
    "license": "BSD-3-Clause",
    "summary": "Build Nice User Interfaces In The Terminal",
    "version": "0.18.0",
    "project_urls": {
        "Changelog": "https://your-tools.github.io/python-cli-ui/changelog.html",
        "Documentation": "https://your-tools.github.io/python-cli-ui/",
        "Homepage": "https://git.sr.ht/~your-tools/python-cli-ui",
        "Issues": "https://github.com/your-tools/python-cli-ui/issues",
        "Repository": "https://git.sr.ht/~your-tools/python-cli-ui"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2407167c0ccdcf220613872ca25c50d6006b841c2aac21f0274d4f9e4b80769a",
                "md5": "b99fc259a3be61ee9b7dac2b2a6cf5ae",
                "sha256": "8d9484586d8eaba9f94aebaa12aa876fabdf1a3a50bdca113b2cb739eeaf78fa"
            },
            "downloads": -1,
            "filename": "cli_ui-0.18.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b99fc259a3be61ee9b7dac2b2a6cf5ae",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0.0,>=3.8.1",
            "size": 13401,
            "upload_time": "2024-12-11T13:40:10",
            "upload_time_iso_8601": "2024-12-11T13:40:10.379910Z",
            "url": "https://files.pythonhosted.org/packages/24/07/167c0ccdcf220613872ca25c50d6006b841c2aac21f0274d4f9e4b80769a/cli_ui-0.18.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "26a9b44b1048064206e9ceceffb7ce38aa2432dbf79bd13d45da8a1452a2e3db",
                "md5": "21c01c943fb79a7e92cb8a8a46206ce9",
                "sha256": "3e6c80ada5b4b09c6701ca93daf31df8b70486c64348d1fc7f3288ef3bd0479c"
            },
            "downloads": -1,
            "filename": "cli_ui-0.18.0.tar.gz",
            "has_sig": false,
            "md5_digest": "21c01c943fb79a7e92cb8a8a46206ce9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0.0,>=3.8.1",
            "size": 13012,
            "upload_time": "2024-12-11T13:40:11",
            "upload_time_iso_8601": "2024-12-11T13:40:11.804903Z",
            "url": "https://files.pythonhosted.org/packages/26/a9/b44b1048064206e9ceceffb7ce38aa2432dbf79bd13d45da8a1452a2e3db/cli_ui-0.18.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-11 13:40:11",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "your-tools",
    "github_project": "python-cli-ui",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "lcname": "cli-ui"
}
        
Elapsed time: 0.85282s