Clint: Command Line Interface Tools for Python

0.5.1 · abandoned · verified Thu Apr 16

Clint (Command Line INterface Tools) is a Python package designed to simplify command-line application development. It offers features such as colored text, indented printing, robust column printing, interactive prompting, progress bars, and basic argument parsing. The latest version is 0.5.1, released in 2013, and the project's GitHub repository was archived as read-only in March 2024, indicating it is no longer actively maintained. [2, 4, 6]

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates key features like colored text, indented output, and user prompting. For actual progress bars, import `progress.bar` from `clint.textui` and wrap an iterable. [1, 2, 6]

from clint.textui import puts, colored, indent, prompt, validators
import os

puts(colored.green('Hello, Clint!'))

puts('This text is not indented.')
with indent(4, quote=' > '):
    puts(colored.blue('This text is indented and quoted.'))
    puts('This is also indented.')

# Example of using a progress bar (requires an iterable)
puts('\nProcessing items:')
items = range(1, 6)
# In a real scenario, you'd import progress.bar for this, e.g., from clint.textui import progress
# For quickstart, a simple loop for demonstration.
for i in items:
    puts(f'  Processing item {i}...')
    # Simulate work
    # time.sleep(0.1)

# Example of prompting for input
# To demonstrate, we'll get a dummy value or use an environment variable for non-interactive tests.
username = prompt.query('Enter your username:', default=os.environ.get('CLINT_USERNAME', 'guest'))
puts(f'Welcome, {username}!')

view raw JSON →