clint


Nameclint JSON
Version 0.5.1 PyPI version JSON
download
home_pagehttps://github.com/kennethreitz/clint
SummaryPython Command Line Interface Tools
upload_time2015-08-25 16:11:19
maintainerNone
docs_urlNone
authorKenneth Reitz
requires_pythonNone
licenseISC
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            Clint: Python Command-line Application Tools
============================================

**Clint** is a module filled with a set of awesome tools for developing
commandline applications.

.. image:: https://raw.github.com/kennethreitz/clint/master/misc/clint.jpeg

**C** ommand
**L** ine
**IN** terface
**T** ools
. 


Clint 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.

Awesome 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.

It 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.

The world's easiest to use implicit argument system w/ chaining methods for filtering. Seriously. 


Run the various executables in examples_ to get a good feel for what Clint offers.

.. _examples: https://github.com/kennethreitz/clint/tree/master/examples

You'll never want to not use it.



Current Features:
-----------------
- Little Documentation (bear with me for now)
- CLI Colors and Indents
- Extremely Simple + Powerful Column Printer
- Iterator-based Progress Bar
- Implicit Argument Handling
- Simple Support for Incoming Unix Pipes
- Application Directory management


Future Features:
----------------
- Documentation!
- Simple choice system ``Are you sure? [Yn]``
- Suggestions welcome.


Example
-------

I want to indent my console text. ::

    >>> from clint.textui import puts, indent

    >>> puts('not indented text')
    >>> with indent(4):
    >>>     puts('indented text')
    not indented text
        indented text

I want to quote my console text (like email). ::

    >>> puts('not indented text')
    >>> with indent(4, quote=' >'):
    >>>     puts('quoted text')
    >>>     puts('pretty cool, eh?')
    
    not indented text
     >  quoted text
     >  pretty cool, eh?

I want to color my console text. ::

    >>> from clint.textui import colored, puts

    >>> puts(colored.red('red text'))
    red text

    # It's red in Windows, OSX, and Linux alike.

I want to get data piped to stdin. ::

    >>> clint.piped_in()
    
    # if no data was piped in, piped_in returns None


I want to get the first commandline argument passed in. ::

    >>> from clint import arguments
    >>> args = arguments.Args()
    >>> args.get(0)

    # if no argument was passed, get returns None


I want to store a configuration file. ::

    >>> from clint import resources

    >>> resources.init('Company', 'AppName')
    >>> resources.user.write('config.ini', file_contents)

    # OSX: '/Users/appuser/Library/Application Support/AppName/config.ini'
    # Windows: 'C:\\Users\\appuser\\AppData\\Local\\Company\\AppName\\config.ini'
    # Linux: '/home/appuser/.config/appname/config.ini'

I want to force color output even if stdout is not a TTY:

    $ export CLINT_FORCE_COLOR=1

I want to ask for input. ::

    >>> from clint.textui import prompt, validators
    >>> path = prompt.query('Installation Path', default='/usr/local/bin/', validators=[validators.PathValidator()])


Installation
------------

To install clint, simply: ::

    $ pip install clint

Or, if you absolutely must: ::

    $ easy_install clint

But, you really shouldn't do that.



License:
--------

ISC License. ::

    Copyright (c) 2011, Kenneth Reitz <me@kennethreitz.com>

    Permission to use, copy, modify, and/or distribute this software for any
    purpose with or without fee is hereby granted, provided that the above
    copyright notice and this permission notice appear in all copies.

    THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
    WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
    MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
    ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
    ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.


Contribute
----------

If you'd like to contribute, simply fork `the repository`_, commit your changes
to the **master** branch (or branch off of it), and send a pull request. Make
sure you add yourself to AUTHORS_.


Roadmap
-------
- Unittests
- Sphinx Documentation



.. _`the repository`: http://github.com/kennethreitz/clint
.. _AUTHORS: http://github.com/kennethreitz/clint/blob/master/AUTHORS


History
-------

0.5.1
+++++
* Fix line width calculation in max_width when using coloured text (thanks to @wkentaro) 

0.5.0
+++++
* Added option prompt


0.4.1
+++++
* Fix bug in logic that decides whether progress bars should be hidden or not


0.4.0
+++++
* clint.textui.prompt now has a query function with validators! (thanks to @aeby) - see `examples/prompt.py`
* Clint docs are now included in sdist (thanks to @alunduil)
* Misc. bug fixes


0.3.7
+++++
* Clint now obeys the CLINT_FORCE_COLOR environmental variable


0.3.6
+++++
* Fixed faulty PyPI deployment


0.3.5
+++++
* progress.bar is now a context manager - doesn't require an iterable anymore (thanks to @jric)
* Bug fixes


0.3.4
+++++
* Fixed Python 3 basestring deprecation
* Fixed examples


0.3.3
+++++
* Fixed Python 3 build issues
* Fixed README and HISTORY being installed to /usr
* Support added for bold text


0.3.2
+++++
* Unknown


0.3.1
+++++
* Unknown


0.3.0
+++++

* Python 3 support!


0.2.4
+++++

* New eng module
* Win32 Bugfix


0.2.3
+++++

* Only init colors if they are used (iPython compatability)
* New progress module
* Various bugfixes


0.2.2
+++++

* Auto Color Disabling
* Progress Namespace Change
* New Progress Bars
* textui.puts newline fix


0.2.1 (2011-03-24)
++++++++++++++++++

* Python 2.5 Support
* List of available colors


0.2.0 (2011-03-23)
++++++++++++++++++

* Column Printing!!!
* (Auto/Manual) Disabling of Colors
* Smarter Colors
* max_width, min_width
* Strip cli colors
* bug fixes


0.1.2 (2011-03-21)
++++++++++++++++++

* Bugfixes


0.1.1 (2011-03-20)
++++++++++++++++++

* Bugfixes
* Indent Newline Injection
* resources: flags, not_flags, files, not_files
* Lots of Examples


0.1.0 (2011-03-20)
++++++++++++++++++

* Initial Release!
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/kennethreitz/clint",
    "name": "clint",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "Kenneth Reitz",
    "author_email": "me@kennethreitz.com",
    "download_url": "https://files.pythonhosted.org/packages/3d/b4/41ecb1516f1ba728f39ee7062b9dac1352d39823f513bb6f9e8aeb86e26d/clint-0.5.1.tar.gz",
    "platform": "UNKNOWN",
    "description": "Clint: Python Command-line Application 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\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    >>> from clint.textui import puts, indent\n\n    >>> puts('not indented text')\n    >>> with indent(4):\n    >>>     puts('indented text')\n    not indented text\n        indented text\n\nI want to quote my console text (like email). ::\n\n    >>> puts('not indented text')\n    >>> with indent(4, quote=' >'):\n    >>>     puts('quoted text')\n    >>>     puts('pretty cool, eh?')\n    \n    not indented text\n     >  quoted text\n     >  pretty cool, eh?\n\nI want to color my console text. ::\n\n    >>> from clint.textui import colored, puts\n\n    >>> 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    >>> 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    >>> from clint import arguments\n    >>> args = arguments.Args()\n    >>> args.get(0)\n\n    # if no argument was passed, get returns None\n\n\nI want to store a configuration file. ::\n\n    >>> from clint import resources\n\n    >>> resources.init('Company', 'AppName')\n    >>> 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    >>> from clint.textui import prompt, validators\n    >>> 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 <me@kennethreitz.com>\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\n\nHistory\n-------\n\n0.5.1\n+++++\n* Fix line width calculation in max_width when using coloured text (thanks to @wkentaro) \n\n0.5.0\n+++++\n* Added option prompt\n\n\n0.4.1\n+++++\n* Fix bug in logic that decides whether progress bars should be hidden or not\n\n\n0.4.0\n+++++\n* clint.textui.prompt now has a query function with validators! (thanks to @aeby) - see `examples/prompt.py`\n* Clint docs are now included in sdist (thanks to @alunduil)\n* Misc. bug fixes\n\n\n0.3.7\n+++++\n* Clint now obeys the CLINT_FORCE_COLOR environmental variable\n\n\n0.3.6\n+++++\n* Fixed faulty PyPI deployment\n\n\n0.3.5\n+++++\n* progress.bar is now a context manager - doesn't require an iterable anymore (thanks to @jric)\n* Bug fixes\n\n\n0.3.4\n+++++\n* Fixed Python 3 basestring deprecation\n* Fixed examples\n\n\n0.3.3\n+++++\n* Fixed Python 3 build issues\n* Fixed README and HISTORY being installed to /usr\n* Support added for bold text\n\n\n0.3.2\n+++++\n* Unknown\n\n\n0.3.1\n+++++\n* Unknown\n\n\n0.3.0\n+++++\n\n* Python 3 support!\n\n\n0.2.4\n+++++\n\n* New eng module\n* Win32 Bugfix\n\n\n0.2.3\n+++++\n\n* Only init colors if they are used (iPython compatability)\n* New progress module\n* Various bugfixes\n\n\n0.2.2\n+++++\n\n* Auto Color Disabling\n* Progress Namespace Change\n* New Progress Bars\n* textui.puts newline fix\n\n\n0.2.1 (2011-03-24)\n++++++++++++++++++\n\n* Python 2.5 Support\n* List of available colors\n\n\n0.2.0 (2011-03-23)\n++++++++++++++++++\n\n* Column Printing!!!\n* (Auto/Manual) Disabling of Colors\n* Smarter Colors\n* max_width, min_width\n* Strip cli colors\n* bug fixes\n\n\n0.1.2 (2011-03-21)\n++++++++++++++++++\n\n* Bugfixes\n\n\n0.1.1 (2011-03-20)\n++++++++++++++++++\n\n* Bugfixes\n* Indent Newline Injection\n* resources: flags, not_flags, files, not_files\n* Lots of Examples\n\n\n0.1.0 (2011-03-20)\n++++++++++++++++++\n\n* Initial Release!",
    "bugtrack_url": null,
    "license": "ISC",
    "summary": "Python Command Line Interface Tools",
    "version": "0.5.1",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "8afd569f077886e2f4e6cca377da2623",
                "sha256": "05224c32b1075563d0b16d0015faaf9da43aa214e4a2140e51f08789e7a4c5aa"
            },
            "downloads": -1,
            "filename": "clint-0.5.1.tar.gz",
            "has_sig": false,
            "md5_digest": "8afd569f077886e2f4e6cca377da2623",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 29355,
            "upload_time": "2015-08-25T16:11:19",
            "upload_time_iso_8601": "2015-08-25T16:11:19.237015Z",
            "url": "https://files.pythonhosted.org/packages/3d/b4/41ecb1516f1ba728f39ee7062b9dac1352d39823f513bb6f9e8aeb86e26d/clint-0.5.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2015-08-25 16:11:19",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "kennethreitz",
    "github_project": "clint",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "tox": true,
    "lcname": "clint"
}
        
Elapsed time: 0.02470s