Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
PyPI

clint 0.5.1

pip install clint

Latest version

Released:

Python Command Line Interface Tools

Verified details

These details have beenverified by PyPI
Maintainers
Avatar for jpiper from gravatar.comjpiperAvatar for kennethreitz from gravatar.comkennethreitzAvatar for tuxtimo from gravatar.comtuxtimo

Unverified details

These details havenot been verified by PyPI
Project links
Meta

Project description

Clint is a module filled with a set of awesome tools for developingcommandline applications.

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

C ommandL ineIN terfaceT 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 inexamples to get a good feel for what Clint offers.

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 systemAre 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 anypurpose with or without fee is hereby granted, provided that the abovecopyright notice and this permission notice appear in all copies.THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIESWITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OFMERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FORANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGESWHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ANACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OFOR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Contribute

If you’d like to contribute, simply forkthe repository, commit your changesto themaster branch (or branch off of it), and send a pull request. Makesure you add yourself toAUTHORS.

Roadmap

  • Unittests

  • Sphinx Documentation

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) - seeexamples/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!

Project details

Verified details

These details have beenverified by PyPI
Maintainers
Avatar for jpiper from gravatar.comjpiperAvatar for kennethreitz from gravatar.comkennethreitzAvatar for tuxtimo from gravatar.comtuxtimo

Unverified details

These details havenot been verified by PyPI
Project links
Meta

Download files

Download the file for your platform. If you're not sure which to choose, learn more aboutinstalling packages.

Source Distribution

clint-0.5.1.tar.gz (29.4 kBview details)

UploadedSource

File details

Details for the fileclint-0.5.1.tar.gz.

File metadata

  • Download URL:clint-0.5.1.tar.gz
  • Upload date:
  • Size: 29.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for clint-0.5.1.tar.gz
AlgorithmHash digest
SHA25605224c32b1075563d0b16d0015faaf9da43aa214e4a2140e51f08789e7a4c5aa
MD58afd569f077886e2f4e6cca377da2623
BLAKE2b-2563db441ecb1516f1ba728f39ee7062b9dac1352d39823f513bb6f9e8aeb86e26d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security SponsorDatadog MonitoringDepot Continuous IntegrationFastly CDNGoogle Download AnalyticsPingdom MonitoringSentry Error loggingStatusPage Status page

[8]ページ先頭

©2009-2025 Movatter.jp