mimi

Crates.iomimi
lib.rsmimi
version0.1.2
sourcesrc
created_at2019-01-05 03:53:49.428034
updated_at2019-01-05 04:17:01.638144
descriptionA library for terminal-oriented runtime string formatting and interpolation.
homepagehttps://github.com/deifactor/catgirl/tree/mistress/mimi
repositoryhttp://github.com/deifactor/catgirl
max_upload_size
id105586
size68,173
Ash (deifactor)

documentation

README

Build Status Crate version

mimi is a library for allowing the user to control how part of a terminal program is formatted. The main usecase is for the catgirl command-line mpd client, but of course other uses are welcome.

A demo of mimi formatting

Syntax

Variables are included using shell-like $foo syntax. Variable names can contain a-zA-Z0-9_ (ASCII-only). ${foo}bar is valid syntax, and is parsed as a variable named 'foo' followed immediately by the literal bar.

A styled section looks like %[bold]{blah $foo blah}. The style information goes between the square brackets. Valid style names are:

  • the colors black, white, red, green, yellow, blue, magenta, cyan, as well as light_black, light_white, etc., which indicate the color of the corresponding text.
  • any color with bg_ prefixed (for example, bg_yellow, bg_light_blue), which sets the background color.
  • reset and bg_reset, which set the foreground/background color to the terminal's default.
  • bold and underline.

You can have multiple styles in a style section, so %[bold, red, bg_blue]{foo bar baz} is valid, if eye-searing. Style sections can nest.

Output

Mimi has support for outputting xterm-compatible ANSI codes using termion, and if the to_tui feature is enabled (it's disabled by default), you'll be able to call style.into() to get an instance of tui::style::Style.

Demo

The demo binary in src/examples/demo.rs allows you to play around with mimi formatting. Run it like

cargo run --example demo -- -f "foo is %[bold]{\$foo}" foo=bar

What's in a name?

'Nekomimi' is the Japanese word for 'person with cat ears', with 'neko' meaning 'cat' and 'mimi' meaning 'ears'.

Commit count: 0

cargo fmt