Crates.io | fyi_msg |
lib.rs | fyi_msg |
version | 1.2.0 |
source | src |
created_at | 2021-06-15 02:29:34.831397 |
updated_at | 2024-11-08 20:31:43.820118 |
description | Simple ANSI-formatted, prefixed messages for console printing. |
homepage | |
repository | https://github.com/Blobfolio/fyi |
max_upload_size | |
id | 410210 |
size | 144,540 |
This crate contains the objects providing the heart of the FYI command line application, namely Msg
, a simple struct for status-like messages that can be easily printed to STDOUT
or STDERR
.
use fyi_msg::{Msg, MsgKind};
// One way.
Msg::new(MsgKind::Success, "You did it!")
.with_newline(true)
.print();
// Another equivalent way.
Msg::success("You did it!").print();
For more usage examples, check out the examples/msg
demo, which covers just about every common use case.
Macro | Equivalent |
---|---|
confirm!(…) |
Msg::new(MsgKind::Confirm, "Some question…").prompt() |
Feature | Description |
---|---|
fitted |
Enables Msg::fitted for obtaining a slice trimmed to a specific display width. |
progress |
Enables Progless , a thread-safe CLI progress bar displayer. |
timestamps |
Enables timestamp-related methods and flags like Msg::with_timestamp . |