clint2

Python Command-line Application Tools
Download

clint2 Ranking & Summary

Advertisement

  • Rating:
  • License:
  • ISC License
  • Price:
  • FREE
  • Publisher Name:
  • Mahdi Yusuf

clint2 Tags


clint2 Description

clint2 is a Python module filled with a set of awesome tools for developing command-line applications.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.You'll never want to not use it.ExampleI 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 textI 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(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 NoneI want to get the first commandline argument passed in.>>> clint.args.get(0)# if no argument was passed, get returns NoneI 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'InstallationTo install clint, simply:pip install clintOr, if you absolutely must: easy_install clintBut, you really shouldn't do that.Product's homepage


clint2 Related Software