{"id":13542350,"url":"https://github.com/kennethreitz/clint","last_synced_at":"2025-04-02T10:30:41.308Z","repository":{"id":1111399,"uuid":"980240","full_name":"kennethreitz/clint","owner":"kennethreitz","description":"Python Command-line Application Tools","archived":true,"fork":false,"pushed_at":"2023-09-22T13:46:56.000Z","size":849,"stargazers_count":97,"open_issues_count":51,"forks_count":18,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-05T12:08:08.841Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://pypi.python.org/pypi/clint/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kennethreitz.png","metadata":{"files":{"readme":"README.rst","changelog":"HISTORY.rst","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":"AUTHORS","dei":null}},"created_at":"2010-10-12T02:40:00.000Z","updated_at":"2025-03-02T00:45:36.000Z","dependencies_parsed_at":"2024-03-30T20:06:07.365Z","dependency_job_id":"27b4fc71-fd6e-4861-a760-b344d362ed9a","html_url":"https://github.com/kennethreitz/clint","commit_stats":null,"previous_names":["kennethreitz/clint","kennethreitz-archive/clint"],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kennethreitz%2Fclint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kennethreitz%2Fclint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kennethreitz%2Fclint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kennethreitz%2Fclint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kennethreitz","download_url":"https://codeload.github.com/kennethreitz/clint/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246796759,"owners_count":20835441,"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":[],"created_at":"2024-08-01T10:01:05.277Z","updated_at":"2025-04-02T10:30:40.757Z","avatar_url":"https://github.com/kennethreitz.png","language":"Python","funding_links":[],"categories":["Command-line Tools","资源列表","Command-line Interface Development","Python","Awesome Python"],"sub_categories":["命令行工具","Command-line Tools"],"readme":"Clint: Python Command-line Interface Tools\n============================================\n\n**Clint** is a module filled with a set of awesome tools for developing\ncommandline applications.\n\n.. image:: https://raw.github.com/kennethreitz/clint/master/misc/clint.jpeg\n\n**C** ommand\n**L** ine\n**IN** terface\n**T** ools\n. \n\n\nClint is awesome. Crazy awesome. It supports colors, but detects if the session is a TTY, so doesn't render the colors if you're piping stuff around. Automagically.\n\nAwesome nest-able indentation context manager. Example: (``with indent(4): puts('indented text')``). It supports custom email-style quotes. Of course, it supports color too, if and when needed.\n\nIt has an awesome Column printer with optional auto-expanding columns. It detects how wide your current console is and adjusts accordingly. It wraps your words properly to fit the column size. With or without colors mixed in. All with a single function call.\n\nThe world's easiest to use implicit argument system w/ chaining methods for filtering. Seriously. \n\n\nRun the various executables in examples_ to get a good feel for what Clint offers.\n\n.. _examples: https://github.com/kennethreitz/clint/tree/master/examples\n\nYou'll never want to not use it.\n\n.. image:: https://travis-ci.org/kennethreitz/clint.png?branch=master\n   :target: https://travis-ci.org/kennethreitz/clint\n\nCurrent Features:\n-----------------\n- Little Documentation (bear with me for now)\n- CLI Colors and Indents\n- Extremely Simple + Powerful Column Printer\n- Iterator-based Progress Bar\n- Implicit Argument Handling\n- Simple Support for Incoming Unix Pipes\n- Application Directory management\n\n\nFuture Features:\n----------------\n- Documentation!\n- Simple choice system ``Are you sure? [Yn]``\n- Suggestions welcome.\n\n\nExample\n-------\n\nI want to indent my console text. ::\n\n    \u003e\u003e\u003e from clint.textui import puts, indent\n\n    \u003e\u003e\u003e puts('not indented text')\n    \u003e\u003e\u003e with indent(4):\n    \u003e\u003e\u003e     puts('indented text')\n    not indented text\n        indented text\n\nI want to quote my console text (like email). ::\n\n    \u003e\u003e\u003e puts('not indented text')\n    \u003e\u003e\u003e with indent(4, quote=' \u003e'):\n    \u003e\u003e\u003e     puts('quoted text')\n    \u003e\u003e\u003e     puts('pretty cool, eh?')\n    \n    not indented text\n     \u003e  quoted text\n     \u003e  pretty cool, eh?\n\nI want to color my console text. ::\n\n    \u003e\u003e\u003e from clint.textui import colored, puts\n\n    \u003e\u003e\u003e puts(colored.red('red text'))\n    red text\n\n    # It's red in Windows, OSX, and Linux alike.\n\nI want to get data piped to stdin. ::\n\n    \u003e\u003e\u003e clint.piped_in()\n    \n    # if no data was piped in, piped_in returns None\n\n\nI want to get the first commandline argument passed in. ::\n\n    \u003e\u003e\u003e from clint import arguments\n    \u003e\u003e\u003e args = arguments.Args()\n    \u003e\u003e\u003e args.get(0)\n\n    # if no argument was passed, get returns None\n\n\nI want to store a configuration file. ::\n\n    \u003e\u003e\u003e from clint import resources\n\n    \u003e\u003e\u003e resources.init('Company', 'AppName')\n    \u003e\u003e\u003e resources.user.write('config.ini', file_contents)\n\n    # OSX: '/Users/appuser/Library/Application Support/AppName/config.ini'\n    # Windows: 'C:\\\\Users\\\\appuser\\\\AppData\\\\Local\\\\Company\\\\AppName\\\\config.ini'\n    # Linux: '/home/appuser/.config/appname/config.ini'\n\nI want to force color output even if stdout is not a TTY:\n\n    $ export CLINT_FORCE_COLOR=1\n\nI want to ask for input. ::\n\n    \u003e\u003e\u003e from clint.textui import prompt, validators\n    \u003e\u003e\u003e path = prompt.query('Installation Path', default='/usr/local/bin/', validators=[validators.PathValidator()])\n\n\nInstallation\n------------\n\nTo install clint, simply: ::\n\n    $ pip install clint\n\nOr, if you absolutely must: ::\n\n    $ easy_install clint\n\nBut, you really shouldn't do that.\n\n\n\nLicense:\n--------\n\nISC License. ::\n\n    Copyright (c) 2011, Kenneth Reitz \u003cme@kennethreitz.com\u003e\n\n    Permission to use, copy, modify, and/or distribute this software for any\n    purpose with or without fee is hereby granted, provided that the above\n    copyright notice and this permission notice appear in all copies.\n\n    THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n    WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n    MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n    ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n    ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n\n\nContribute\n----------\n\nIf you'd like to contribute, simply fork `the repository`_, commit your changes\nto the **master** branch (or branch off of it), and send a pull request. Make\nsure you add yourself to AUTHORS_.\n\n\nRoadmap\n-------\n- Unittests\n- Sphinx Documentation\n\n\n\n.. _`the repository`: http://github.com/kennethreitz/clint\n.. _AUTHORS: http://github.com/kennethreitz/clint/blob/master/AUTHORS\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkennethreitz%2Fclint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkennethreitz%2Fclint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkennethreitz%2Fclint/lists"}