Skip to main content

Simple library built around making terminal interaction easy.

Project description

Conterm

Version Maintained
Tests Coverage

Conterm is a simple to use terminal interaction library. This includes:

  • conterm.control
    • Keyboard input
    • Mouse input
    • Terminal actions like moving the cursor, deleting lines, etc...
  • conterm.pretty
    • Pretty printing python objects
    • Simple inline markup for strings
    • Ansi sequence stripping
  • conterm.logging
    • Simple thread safe logging
  • conterm.cli
    • Prompts: includes yes/no prompts, hidden password prompts, and normal input prompts
    • Radio Select: List of options are displayed and the user can select one of many options.
    • Multi Select: List of options are displayed and the user can select multiple of many options.
    • Task Manager: This is a thread safe object that prints and updates a region in the terminal over time. When it is active no other printing to stdout should occur. The task manager lets you add messages, spinners, and progress bars with intuitive ways of updating progress over time.

With all the above features in mind, make sure to check out the examples to see the different features in action.

note: This library is experimental and a work in progress. Any and all feedback is welcome.

Markup

This should be an easy to use familiar syntax. b, i, u, s equal bold, italic, underline and strikethrough respectively. ~<url> represents a hyperlink. <, ^, > represent left, center and right align respectively as long as a total width is also provided. Additionally, conterm allows the user to define their own macros that can either generate text or modify text. The custom macros are called outright like builtin macros which allows for macro overloading. There can be multiple macros per block seperated by a space and each macro is persistant until they are closed with a /. All system colors are supported by name. There is also hex, xterm, and rgb support. By default the color is for the foreground, but if it is prefixed with @ it will be applied to the background.

Examples

[b i]Bold italic[/b] just italic [/i] normal text
[u s]Underlined and strikethrough[/] normal text
[^30]30 char center aligned[<70%]Closes previous alignment and starts this one
[^full]Can use percentages and full keyword; full == 100%
[~http://example.com]Example Url [~http://example.com]Another url[/~]
[red]Red text [@white] now with white background[/fg /bg]

[#f32]Red text [@243] grey background[/]

[100,15,100]RGB colored text[/]

Made with python Built with love

Project details


Download files

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

Source Distribution

conterm-0.1.0.tar.gz (60.6 kB view hashes)

Uploaded Source

Built Distribution

conterm-0.1.0-py3-none-any.whl (47.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page