Skip to content

Provide a string and a style type for terminal formatted output.

License

Notifications You must be signed in to change notification settings

rust-alt/term-string

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

term-string Travis Build Status AppVeyor Build Status

Documentation

Provide a string and a style type for terminal formatted output.

Why?

I noticed that crates tend to either depend on ansi_term directly, and thus lack Windows console support (prior to Windows 10), or include their own wrapping code around term.

This crate is an attempt to create a nice usable wrap around term everyone can use. It should just work with terminfo terminals, Windows 10 virtual terminal support*, and the Windows console.

* Requires a personal term branch, for now.

Examples

First, add the dependency to Cargo.toml:

[dependencies]
term-string = { git = "https://github.com/rust-alt/term-string.git" }
// color is a re-exported module from term
use term_string::color::{GREEN, RED};

use term_string::{TermString, TermStyle};

// Create term styles
let style1 = TermStyle::bold() + TermStyle::fg(GREEN) + TermStyle::bg(RED);
let style2 = TermStyle::underline(true);

// Create term string from a style and a string value
let mut ts = TermString::new(style1, "style");

// "1" inherits style1
ts+= "1";

// " : " is un-styled
ts += TermString::from(" : ");

ts += TermString::new(style2, "This is text with style 2");

ts.println();

Detailed Build Status

Travis

Linux OSX
linux-stable osx-stable
linux-beta osx-beta
linux-nightly osx-nightly

AppVeyor

Windows x86_64 i686
stable satble x86_64 stable i686
beta beta x86_64 beta i686
nightly nightly x86_64 nightly i686

About

Provide a string and a style type for terminal formatted output.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages