10 releases (1 stable)

1.0.0 Jan 9, 2021
0.4.2-alpha.0 Jan 9, 2021
0.4.1 Mar 11, 2020
0.3.0 Mar 10, 2020
0.1.3 May 28, 2019

#57 in Command-line interface

Download history 13/week @ 2021-02-25 6/week @ 2021-03-04 9/week @ 2021-03-11 7/week @ 2021-03-18 44/week @ 2021-03-25 15/week @ 2021-04-01 19/week @ 2021-04-08 37/week @ 2021-04-15 24/week @ 2021-04-22 25/week @ 2021-04-29 6/week @ 2021-05-06 17/week @ 2021-05-13 8/week @ 2021-05-20 11/week @ 2021-05-27 10/week @ 2021-06-03 25/week @ 2021-06-10

93 downloads per month
Used in 2 crates

MIT license

7KB

leg

πŸ”ˆ Elegant print for lazy devs

Demo

Build Status Latest version Stability stable

πŸ€™ Ping me on Twitter if you like this project

Make your CLIs nicer with minimal effort. Simple wrapper on top of:

Do not use this crate in libraries! You should use the log one instead. Visit this section of the book Command line apps in Rust if you want to learn more about this topic.

Install

With cargo-edit installed run:

cargo add leg

Use

πŸ“ Please visit tests and full documentation if you want to learn the details.

use async_std::{eprint, eprintln};
use leg::*;

#[async_std::main]
async fn main() {
    head("leg", Some("πŸ”ˆ"), Some("1.0.0")).await;

    info("Informational message", None, None).await;
    success("Successful operation", None, None).await;
    warn("Warn message", None, None).await;
    error("Error message", None, None).await;
    wait("Waiting for something", None, None).await;
    done("Something finished", None, None).await;

    info("Informational message with scope", Some("myscope"), None).await;
    info("Informational message without new line", None, Some(false)).await;
    eprintln!(" => same line").await;

    eprint!("Not shown").await;
    remove().await;

    result("To standard output").await;
}

Contributing

😎 If you want to help please take a look to this file.

Dependencies

~1.4–3MB
~65K SLoC