iq_cli/
lib.rs

1//! Cargo-like command-line interfaces with selectively-colored status output
2
3#![crate_name = "iq_cli"]
4#![crate_type = "rlib"]
5#![deny(warnings, missing_docs, unsafe_code, unused_import_braces, unused_qualifications)]
6#![doc(html_root_url = "https://docs.rs/iq-cli/0.1.0")]
7
8#[macro_use]
9extern crate lazy_static;
10extern crate libc;
11extern crate term;
12
13mod macros;
14mod shell;
15
16pub use shell::{ColorConfig, Shell, ShellConfig};
17pub use term::color;
18pub use term::color::Color;
19
20use std::fmt;
21use std::sync::Mutex;
22
23lazy_static! {
24    static ref SHELL: Mutex<Shell> = Mutex::new(Shell::default());
25}
26
27/// Say a status message with the given color
28pub fn status<T, U>(color: Color, status: T, message: U, justified: bool)
29where
30    T: fmt::Display,
31    U: fmt::Display,
32{
33    SHELL
34        .lock()
35        .unwrap()
36        .status(color, status, message, justified)
37        .unwrap();
38}