Crate fyi_msg[][src]

Expand description

FYI Msg

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.

Examples

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.

Macros

MacroEquivalent
confirm!(…)Msg::new(MsgKind::Confirm, "Some question…").prompt()

Optional Features

FeatureDescription
fittedEnables Msg::fitted for obtaining a slice trimmed to a specific display width.
progressEnables Progless, a thread-safe CLI progress bar displayer.
timestampsEnables timestamp-related methods and flags like Msg::with_timestamp.

Macros

confirm

Confirm.

Structs

BeforeAfter

Before and After.

Msg

Message.

Progless

Progless.

Enums

MsgKind

Message Kind.

ProglessError

Obligatory error type.

Constants

FLAG_INDENT

Enable Indentation (equivalent to 4 spaces).

FLAG_NEWLINE

Enable Trailing Line.

FLAG_TIMESTAMP

Enable Timestamp.

Functions

length_width

Length Width.

width

Width.