FYI is a simple CLI tool for x86-64 Linux machines that prints an arbitrary status-style message, optionally indented, timestamped, and/or prefixed. You know, stuff like:
- Error: Something broke!
- Warning: I can't keep doing this!
- Success: Life is good!
(Github doesn't display colored text, but just imagine the error prefix in , the success in , etc.)
That's it!
The main idea is to make it easier to communicate successes and errors from within shell scripts, particularly in regards to color. ANSI formatting isn't difficult, but all that extra code is difficult to read.
Take for example:
# The manual way.
echo "\033[1;91mError:\033[0m Something broke!"
# Using FYI:
fyi error "Something broke!"
Debian and Ubuntu users can just grab the pre-built .deb
package from the latest release.
This application is written in Rust and can alternatively be built from source using Cargo:
# Clone the source.
git clone https://github.com/Blobfolio/fyi.git
# Go to it.
cd fyi
# Build as usual. Specify additional flags as desired.
cargo build \
--bin fyi \
--release
(This should work under other 64-bit Unix environments too, like MacOS.)
The primary usage is to generate a message with one of the default prefixes,
like: fyi <PREFIX> [flags] [options] <MSG>
, where the prefix is one of:
The following flags and options are available.
Short | Long | Value | Description | Default |
---|---|---|---|---|
-e |
--exit |
<num> |
Exit with this status code after printing. | 0 |
-h |
--help |
Print help information and exit. | ||
-i |
--indent |
Indent the line. | ||
--stderr |
Print to STDERR instead of STDOUT. | |||
-t |
--timestamp |
Include a timestamp. |
To use a custom prefix (or no prefix), run fyi print [flags] [options] <MSG>
,
using the following additional options:
Short | Long | Value | Description | Default |
---|---|---|---|---|
-p |
--prefix |
<txt> |
Set a custom prefix. | |
-c |
--prefix-color |
<num> |
Prefix color. | 199 |
The color should be a u8
corresponding to a BASH color number.
Note: to avoid the cost of re-alignment, only values in the range of 1..=255
are supported.
To prompt a user for a Y/N (and exit with a corresponding status code), run
fyi confirm [flags] [options] <MSG>
. Confirmation supports the same flags as
the other built-in prefixes.
And finally, there is a convenient blank
subcommand that does nothing but
print a certain number of blank lines for you. Run
fyi blank [flags] [options]
, which supports the following:
Short | Long | Value | Description | Default |
---|---|---|---|---|
-h |
--help |
Print help information and exit. | ||
--stderr |
Print to STDERR instead of STDOUT. | |||
-c |
--count |
<num> |
Number of empty lines to print. | 1 |
See also: CREDITS.md
Copyright © 2024 Blobfolio, LLC <[email protected]>
This work is free. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <[email protected]>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.