Skip to content

Commit

Permalink
release: 0.11.5
Browse files Browse the repository at this point in the history
  • Loading branch information
joshstoik1 committed Sep 18, 2023
2 parents e240b82 + 9ce7c64 commit e213676
Show file tree
Hide file tree
Showing 19 changed files with 75 additions and 36 deletions.
6 changes: 3 additions & 3 deletions CREDITS.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Project Dependencies
Package: fyi
Version: 0.11.4
Generated: 2023-09-17 23:07:57 UTC
Version: 0.11.5
Generated: 2023-09-18 03:13:54 UTC

| Package | Version | Author(s) | License |
| ---- | ---- | ---- | ---- |
| [argyle](https://github.com/Blobfolio/argyle) | 0.6.8 | [Blobfolio, LLC.](mailto:[email protected]) | WTFPL |
| [const_fn](https://github.com/taiki-e/const_fn) | 0.4.9 | | Apache-2.0 or MIT |
| [dactyl](https://github.com/Blobfolio/dactyl) | 0.5.1 | [Blobfolio, LLC.](mailto:[email protected]) | WTFPL |
| [fyi_msg](https://github.com/Blobfolio/fyi) | 0.11.4 | [Blobfolio, LLC.](mailto:[email protected]) | WTFPL |
| [fyi_msg](https://github.com/Blobfolio/fyi) | 0.11.5 | [Blobfolio, LLC.](mailto:[email protected]) | WTFPL |
| [num-traits](https://github.com/rust-num/num-traits) | 0.2.16 | The Rust Project Developers | Apache-2.0 or MIT |
| [tz-rs](https://github.com/x-hgg-x/tz-rs) | 0.6.14 | x-hgg-x | Apache-2.0 or MIT |
| [utc2k](https://github.com/Blobfolio/utc2k) | 0.6.1 | [Blobfolio, LLC.](mailto:[email protected]) | WTFPL |
2 changes: 1 addition & 1 deletion fyi/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fyi"
version = "0.11.4"
version = "0.11.5"
license = "WTFPL"
authors = ["Blobfolio, LLC. <[email protected]>"]
edition = "2021"
Expand Down
2 changes: 1 addition & 1 deletion fyi_msg/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fyi_msg"
version = "0.11.4"
version = "0.11.5"
authors = ["Blobfolio, LLC. <[email protected]>"]
edition = "2021"
rust-version = "1.70"
Expand Down
12 changes: 12 additions & 0 deletions fyi_msg/examples/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,18 @@ fn main() {

println!();

// A prompt to STDERR.
if Msg::new(MsgKind::Confirm, "Did this print to STDERR?").eprompt_with_default(true) {
Msg::plain("Great!")
.with_newline(true)
.print();
}
else {
Msg::plain("Are you sure?!")
.with_newline(true)
.print();
}

// Here's that macro we mentioned earlier.
if confirm!(yes: "Was this example useful?") {
Msg::plain("Great!")
Expand Down
33 changes: 30 additions & 3 deletions fyi_msg/src/msg/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1016,12 +1016,37 @@ impl Msg {
pub fn prompt(&self) -> bool { self.prompt_with_default(false) }

#[must_use]
#[inline]
/// # Prompt (w/ Default).
///
/// This is identical to [`Msg::prompt`], except you specify the default
/// return value — `true` for Yes, `false` for No — that is returned when
/// the user just hits `<ENTER>`.
pub fn prompt_with_default(&self, default: bool) -> bool {
self._prompt(default, false)
}

#[must_use]
#[inline]
/// # Prompt (STDERR).
///
/// Same as [`Msg::prompt`], but printed to STDERR instead of STDOUT.
pub fn eprompt(&self) -> bool { self.eprompt_with_default(false) }

#[must_use]
#[inline]
/// # Prompt (w/ Default, STDERR).
///
/// Same as [`Msg::prompt_with_default`], but printed to STDERR instead of
/// STDOUT.
pub fn eprompt_with_default(&self, default: bool) -> bool {
self._prompt(default, true)
}

/// # Internal Prompt Handling.
///
/// This prints the prompt, handling the desired default and output.
fn _prompt(&self, default: bool, stderr: bool) -> bool {
// Clone the message and append a little [y/N] instructional bit to the
// end. This might not be necessary, but preserves the original message
// in case it is needed again.
Expand All @@ -1035,7 +1060,8 @@ impl Msg {
// Ask and collect input, looping until a valid response is typed.
let mut result = String::new();
loop {
q.print();
if stderr { q.eprint(); }
else { q.print(); }

if let Some(res) = io::stdin().read_line(&mut result)
.ok()
Expand All @@ -1049,8 +1075,9 @@ impl Msg {

// Print an error and do it all over again.
result.truncate(0);
Self::error("Invalid input; enter \x1b[91mN\x1b[0m or \x1b[92mY\x1b[0m.")
.print();
let err = Self::error("Invalid input; enter \x1b[91mN\x1b[0m or \x1b[92mY\x1b[0m.");
if stderr { err.eprint(); }
else { err.print(); }
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions release/man/fyi-blank.1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.TH "FYI BLANK" "1" "September 2023" "blank v0.11.4" "User Commands"
.TH "FYI BLANK" "1" "September 2023" "blank v0.11.5" "User Commands"
.SH NAME
blank \- Manual page for blank v0.11.4.
blank \- Manual page for blank v0.11.5.
.SH DESCRIPTION
Print blank line(s).
.SS USAGE:
Expand Down
4 changes: 2 additions & 2 deletions release/man/fyi-confirm.1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.TH "FYI CONFIRM" "1" "September 2023" "confirm v0.11.4" "User Commands"
.TH "FYI CONFIRM" "1" "September 2023" "confirm v0.11.5" "User Commands"
.SH NAME
confirm \- Manual page for confirm v0.11.4.
confirm \- Manual page for confirm v0.11.5.
.SH DESCRIPTION
Ask a Yes/No question using the built\-in prefix "confirm".
.SS USAGE:
Expand Down
4 changes: 2 additions & 2 deletions release/man/fyi-crunched.1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.TH "FYI CRUNCHED" "1" "September 2023" "crunched v0.11.4" "User Commands"
.TH "FYI CRUNCHED" "1" "September 2023" "crunched v0.11.5" "User Commands"
.SH NAME
crunched \- Manual page for crunched v0.11.4.
crunched \- Manual page for crunched v0.11.5.
.SH DESCRIPTION
Crunched: Hello World
.SS USAGE:
Expand Down
4 changes: 2 additions & 2 deletions release/man/fyi-debug.1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.TH "FYI DEBUG" "1" "September 2023" "debug v0.11.4" "User Commands"
.TH "FYI DEBUG" "1" "September 2023" "debug v0.11.5" "User Commands"
.SH NAME
debug \- Manual page for debug v0.11.4.
debug \- Manual page for debug v0.11.5.
.SH DESCRIPTION
Debug: Hello World
.SS USAGE:
Expand Down
4 changes: 2 additions & 2 deletions release/man/fyi-done.1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.TH "FYI DONE" "1" "September 2023" "done v0.11.4" "User Commands"
.TH "FYI DONE" "1" "September 2023" "done v0.11.5" "User Commands"
.SH NAME
done \- Manual page for done v0.11.4.
done \- Manual page for done v0.11.5.
.SH DESCRIPTION
Done: Hello World
.SS USAGE:
Expand Down
4 changes: 2 additions & 2 deletions release/man/fyi-error.1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.TH "FYI ERROR" "1" "September 2023" "error v0.11.4" "User Commands"
.TH "FYI ERROR" "1" "September 2023" "error v0.11.5" "User Commands"
.SH NAME
error \- Manual page for error v0.11.4.
error \- Manual page for error v0.11.5.
.SH DESCRIPTION
Error: Hello World
.SS USAGE:
Expand Down
4 changes: 2 additions & 2 deletions release/man/fyi-info.1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.TH "FYI INFO" "1" "September 2023" "info v0.11.4" "User Commands"
.TH "FYI INFO" "1" "September 2023" "info v0.11.5" "User Commands"
.SH NAME
info \- Manual page for info v0.11.4.
info \- Manual page for info v0.11.5.
.SH DESCRIPTION
Info: Hello World
.SS USAGE:
Expand Down
4 changes: 2 additions & 2 deletions release/man/fyi-notice.1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.TH "FYI NOTICE" "1" "September 2023" "notice v0.11.4" "User Commands"
.TH "FYI NOTICE" "1" "September 2023" "notice v0.11.5" "User Commands"
.SH NAME
notice \- Manual page for notice v0.11.4.
notice \- Manual page for notice v0.11.5.
.SH DESCRIPTION
Notice: Hello World
.SS USAGE:
Expand Down
4 changes: 2 additions & 2 deletions release/man/fyi-print.1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.TH "FYI PRINT" "1" "September 2023" "print v0.11.4" "User Commands"
.TH "FYI PRINT" "1" "September 2023" "print v0.11.5" "User Commands"
.SH NAME
print \- Manual page for print v0.11.4.
print \- Manual page for print v0.11.5.
.SH DESCRIPTION
Print a message without a prefix (or with a custom one).
.SS USAGE:
Expand Down
4 changes: 2 additions & 2 deletions release/man/fyi-review.1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.TH "FYI REVIEW" "1" "September 2023" "review v0.11.4" "User Commands"
.TH "FYI REVIEW" "1" "September 2023" "review v0.11.5" "User Commands"
.SH NAME
review \- Manual page for review v0.11.4.
review \- Manual page for review v0.11.5.
.SH DESCRIPTION
Review: Hello World
.SS USAGE:
Expand Down
4 changes: 2 additions & 2 deletions release/man/fyi-success.1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.TH "FYI SUCCESS" "1" "September 2023" "success v0.11.4" "User Commands"
.TH "FYI SUCCESS" "1" "September 2023" "success v0.11.5" "User Commands"
.SH NAME
success \- Manual page for success v0.11.4.
success \- Manual page for success v0.11.5.
.SH DESCRIPTION
Success: Hello World
.SS USAGE:
Expand Down
4 changes: 2 additions & 2 deletions release/man/fyi-task.1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.TH "FYI TASK" "1" "September 2023" "task v0.11.4" "User Commands"
.TH "FYI TASK" "1" "September 2023" "task v0.11.5" "User Commands"
.SH NAME
task \- Manual page for task v0.11.4.
task \- Manual page for task v0.11.5.
.SH DESCRIPTION
Task: Hello World
.SS USAGE:
Expand Down
4 changes: 2 additions & 2 deletions release/man/fyi-warning.1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.TH "FYI WARNING" "1" "September 2023" "warning v0.11.4" "User Commands"
.TH "FYI WARNING" "1" "September 2023" "warning v0.11.5" "User Commands"
.SH NAME
warning \- Manual page for warning v0.11.4.
warning \- Manual page for warning v0.11.5.
.SH DESCRIPTION
Warning: Hello World
.SS USAGE:
Expand Down
4 changes: 2 additions & 2 deletions release/man/fyi.1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.TH "FYI" "1" "September 2023" "FYI v0.11.4" "User Commands"
.TH "FYI" "1" "September 2023" "FYI v0.11.5" "User Commands"
.SH NAME
FYI \- Manual page for fyi v0.11.4.
FYI \- Manual page for fyi v0.11.5.
.SH DESCRIPTION
A dead\-simple CLI status message printer for use in BASH scripts, etc.
.SS USAGE:
Expand Down

0 comments on commit e213676

Please sign in to comment.