Expand description

WIP library for writing interactive CLI programs.

Currently very unstable with a somewhat unusual API. Subject to major changes as I use it and implement missing functionality. Intended to implement the things that the Python click library provides which are missing from clap. Using that basis, provide useful abstractions for interacting with the CLI.

Scope:

  • Pretty status, info, warn and error messages
  • Convenient traits and methods for printing color escape codes when available
  • Print lists and trees
  • Simplify dealing with terminal colors using “color palettes”
  • Request and validate user input
  • Launch $EDITOR to edit plain text and typed data
  • (TODO) Animated spinners (using tokio for async projects and std::thread otherwise)

Out of scope:

  • Non-UNIX platforms
  • Config file handling
  • Argument parsing (intended to be used alongside clap)
  • Progress bars (for now)
  • curses-style text user interface (TUI) painting to the terminal as a canvas

Initially, this library was written as an extension of termcolor, but now the functionality that was required has been absorbed / copied / rewritten. As such, some of the ideas and design are taken from there and credit is due.

Re-exports

pub use crate::core::Buffer;
pub use crate::core::Line;
pub use crate::core::Stream;
pub use crate::core::GetLine;
pub use input::Input;
pub use print::Print;
pub use style::Paint;
pub use style::Palette;
pub use style::Color;
pub use style::Tags;

Modules

Core functionality: dealing with buffers of colored terminal output

Edit text using $EDITOR

User input

Multi-line text segments like Lists or Trees

Color Palette and Tags

Writing colored text to the terminal

Macros

Implement Editable for a type T: Serialize + DeserializeOwned

Structs

The main Conciliator implementor

List of things to print, with a short description

Tree structure of things to print, recursively traversed

Enums

Wraps any Display type to be Inlined with the chosen Color

Wraps any Display type to be Inlined with the chosen Color but in bold

Traits

Convenient methods for printing user-facing messages

Display with colors

Functions

Initialize the main Conciliator implementor, Claw