🔈 Elegant print for lazy devs

Overview

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;
}
You might also like...
Embeddable tree-walk interpreter for a "mostly lazy" Lisp-like scripting language.

ceceio Embeddable tree-walk interpreter for a "mostly lazy" Lisp-like scripting language. Just a work-in-progress testbed for now. Sample usage us

Too lazy to read the full article? Skim it
Too lazy to read the full article? Skim it

SkimGPT When you're too lazy to either read the article or ask AI questions, you can use SkimGPT to help you. Install Clone this repo: git clone https

Lazy Sieve of Eratosthenes for infinitely generating primes lazily in Rust.

lazy-prime-sieve Lazy Sieve of Eratosthenes for infinitely generating primes lazily in Rust. Usage lazy-prime-sieve is a library crate. You may add it

🛎 60+ Elegant terminal spinners for Rust

Spinners - 🛎 60+ Elegant terminal spinners for Rust ❤️ Shameless plug Charts, simple as a URL. No more server-side rendering pain, 1 url = 1 chart Lo

The Elegant Parser

pest. The Elegant Parser pest is a general purpose parser written in Rust with a focus on accessibility, correctness, and performance. It uses parsing

📮 An elegant Telegram bots framework for Rust
📮 An elegant Telegram bots framework for Rust

teloxide A full-featured framework that empowers you to easily build Telegram bots using the async/.await syntax in Rust. It handles all the difficult

The efficient and elegant crate to count variants of Rust's Enum.

variant-counter The efficient and elegant crate to count variants of Rust's Enum. Get started #[derive(VariantCount)] #[derive(VariantCount)] pub enum

An elegant language for script-kiddies and terminal squatters.

Tonic An elegant language for script-kiddies and terminal squatters. About I started Tonic to complete the Advent of Code 2021. My eventual goal is to

 A simple and elegant, pipewire graph editor
A simple and elegant, pipewire graph editor

pw-viz A simple and elegant, pipewire graph editor This is still a WIP, node layouting is kinda jank at the moment. Installation A compiled binary is

Pure, simple and elegant HTML parser and editor.

HTML Editor Pure, simple and elegant HTML parser and editor. Examples Parse HTML segment/document let document = parse("!doctype htmlhtmlhead/h

Elegant, clean Rust development framework

Preview version, will not guarantee the stability of the API! Elegant, clean Rust development framework Core Features Relational database client for M

Wena is a micro-framework that provides an elegant starting point for your console application.
Wena is a micro-framework that provides an elegant starting point for your console application.

Wena was created by Nuno Maduro, and is a Rust Lang micro-framework that provides an elegant starting point for your console application. This project

No-nonsense, elegant request framework

Note: this crate is in an experimental sketch state. Please be careful if using on production environments. nerf nerf stands for: No-nonsense: Correct

Elegant and simple software for managing personal finance.

kash Elegant and simple software for managing personal finance. ⚠️ This project is still a work-in-progress. Author Kees van Voorthuizen License Licen

lla - The Elegant ls Alternative
lla - The Elegant ls Alternative

lla - The Elegant ls Alternative Overview lla (Lightweight ls Alternative) is an elegant and efficient command-line utility written in Rust, designed

Rust macro to use a match-like syntax as a elegant alternative to nesting if-else statement

cond Rust macro to use a match-like syntax as an elegant alternative to many if-else statements. I got the idea from empty Go switch statements. I tho

gstats — command line tool to print a developer handy summary of all git repositories below current directory

gstats Simple Rust tool to get quick summary info on git repos showing latest tag, branch, state. I implemented this to help me work with a the not to

Easy pretty print your Rust struct into single element or table

Easy pretty print your Rust struct into single element or table

tri-angle trader without trade, just watch pair's price change, print arbtrage chance.

tri-angle trader without trade, just watch pair's price change, print arbtrage chance.

Comments
  • Integration with `log` crate facade

    Integration with `log` crate facade

    The Rust logging ecosystem seems to use the log crate as the prefered way to expose logging capabilities and then choose a backend for it.

    Maybe leg should integrate better with log so to change logs rendering, we just have to change the backend and not changing all the logs already present.

    opened by Geobert 1
  • Stream support?

    Stream support?

    For now, the tool can only print to stdout. Rethink about support to stream to different destinations.

    Suggestion: https://www.reddit.com/r/rust/comments/btwmc7/my_second_crate_leg_elegant_logging_made_simple/ep3rgot

    enhancement 
    opened by jesusprubio 1
Owner
Jesús Rubio
Node.js for fish, Golang by night
Jesús Rubio
Embeddable tree-walk interpreter for a "mostly lazy" Lisp-like scripting language.

ceceio Embeddable tree-walk interpreter for a "mostly lazy" Lisp-like scripting language. Just a work-in-progress testbed for now. Sample usage us

Vinícius Miguel 7 Aug 18, 2022
Too lazy to read the full article? Skim it

SkimGPT When you're too lazy to either read the article or ask AI questions, you can use SkimGPT to help you. Install Clone this repo: git clone https

Huy 9 Apr 22, 2023
Lazy Sieve of Eratosthenes for infinitely generating primes lazily in Rust.

lazy-prime-sieve Lazy Sieve of Eratosthenes for infinitely generating primes lazily in Rust. Usage lazy-prime-sieve is a library crate. You may add it

Arindam Das 2 Jul 13, 2023
Print out some fibonacci numbers.

give-me-some-fibonacci A Rust library for some fibonacci. TL;DR: its just a joke. Usage To get started using give_me_some_fibonacci, just add this to

Leonardo Vieira 2 Mar 22, 2022
Easy c̵̰͠r̵̛̠ö̴̪s̶̩̒s̵̭̀-t̶̲͝h̶̯̚r̵̺͐e̷̖̽ḁ̴̍d̶̖̔ ȓ̵͙ė̶͎ḟ̴͙e̸̖͛r̶̖͗ë̶̱́ṉ̵̒ĉ̷̥e̷͚̍ s̷̹͌h̷̲̉a̵̭͋r̷̫̊ḭ̵̊n̷̬͂g̵̦̃ f̶̻̊ơ̵̜ṟ̸̈́ R̵̞̋ù̵̺s̷̖̅ţ̸͗!̸̼͋

Rust S̵̓i̸̓n̵̉ I̴n̴f̶e̸r̵n̷a̴l mutability! Howdy, friendly Rust developer! Ever had a value get m̵̯̅ð̶͊v̴̮̾ê̴̼͘d away right under your nose just when

null 294 Dec 23, 2022
Open source p2p share for devs to share anything with teammates across machines securely.

Secure share Share anything with teammates across machines via CLI. Share is a tool for secure peer-to-peer connections, enabling direct communication

Onboardbase 10 Aug 4, 2023
Lazy Binary Serialization

LBS crates.io | docs.rs Library name stands for Lazy Binary Serialization. We call it "lazy" because it does not serizalize/deserialize struct fields

Roman Kuzmin 7 Feb 19, 2022
High-order Virtual Machine (HVM) is a pure functional compile target that is lazy, non-garbage-collected and massively parallel

High-order Virtual Machine (HVM) High-order Virtual Machine (HVM) is a pure functional compile target that is lazy, non-garbage-collected and massivel

null 5.5k Jan 2, 2023
A simple, stable and thread-safe implementation of a lazy value

Laizy Laizy is a Rust library that provides a simple, stable and thread-safe implementation of a Lazy Features Name Description Dependencies nightly A

Alex 5 May 15, 2022
Rate limit guard - Lazy rate limit semaphore implementation to control your asynchronous code frequency execution

Lazy rate limit semaphore (a.k.a fixed window algorithm without queueing) implementation to control your asynchronous code frequency execution

Yan Kurbatov 4 Aug 1, 2022