11 releases (2 stable)

1.0.1 Jun 22, 2021
1.0.0 Jan 9, 2021
0.4.2-alpha.0 Jan 9, 2021
0.4.1 Mar 11, 2020
0.1.3 May 28, 2019

#85 in Command-line interface

Download history 18/week @ 2021-09-28 8/week @ 2021-10-05 12/week @ 2021-10-12 21/week @ 2021-10-19 11/week @ 2021-10-26 16/week @ 2021-11-02 18/week @ 2021-11-09 19/week @ 2021-11-16 21/week @ 2021-11-23 46/week @ 2021-11-30 16/week @ 2021-12-07 16/week @ 2021-12-14 12/week @ 2021-12-21 16/week @ 2021-12-28 18/week @ 2022-01-04 26/week @ 2022-01-11

74 downloads per month
Used in 2 crates

MIT license

6KB

leg

πŸ”ˆ Elegant print for lazy devs

Demo

Workflow status Latest version

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 leg::*;
use async_std::{eprint, eprintln};

#[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.3–3MB
~63K SLoC