Skip to content

Commit 7f4da15

Browse files
committed
release: 1.7.0
2 parents 236fcde + 2584286 commit 7f4da15

31 files changed

+149
-154
lines changed

CREDITS.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# Project Dependencies
22
Package: fyi
3-
Version: 1.6.1
3+
Version: 1.7.0
44
Target: x86_64-unknown-linux-gnu
5-
Generated: 2025-01-17 08:19:07 UTC
5+
Generated: 2025-02-24 07:32:03 UTC
66

77
| Package | Version | Author(s) | License |
88
| ---- | ---- | ---- | ---- |
9-
| [**argyle**](https://github.com/Blobfolio/argyle) | 0.10.1 | [Josh Stoik](mailto:josh@blobfolio.com) | WTFPL |
9+
| [**argyle**](https://github.com/Blobfolio/argyle) | 0.11.0 | [Josh Stoik](mailto:josh@blobfolio.com) | WTFPL |
1010
| [**dactyl**](https://github.com/Blobfolio/dactyl) | 0.9.1 | [Josh Stoik](mailto:josh@blobfolio.com) | WTFPL |
11-
| [**fyi_msg**](https://github.com/Blobfolio/fyi) | 1.6.1 | [Josh Stoik](mailto:josh@blobfolio.com) | WTFPL |
11+
| [**fyi_msg**](https://github.com/Blobfolio/fyi) | 1.7.0 | [Josh Stoik](mailto:josh@blobfolio.com) | WTFPL |
1212
| [tz-rs](https://github.com/x-hgg-x/tz-rs) | 0.7.0 | x-hgg-x | MIT OR Apache-2.0 |
1313
| [**utc2k**](https://github.com/Blobfolio/utc2k) | 0.11.2 | [Josh Stoik](mailto:josh@blobfolio.com) | WTFPL |
1414

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[workspace]
2-
resolver = "2"
2+
resolver = "3"
33
members = [
44
"fyi",
55
"fyi_msg",

README.md

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,23 +39,15 @@ fyi error "Something broke!"
3939

4040
Debian and Ubuntu users can just grab the pre-built `.deb` package from the [latest release](https://github.com/Blobfolio/fyi/releases/latest).
4141

42-
This application is written in [Rust](https://www.rust-lang.org/) and can alternatively be built from source using [Cargo](https://github.com/rust-lang/cargo):
42+
This application is written in [Rust](https://www.rust-lang.org/) and can alternatively be built/installed from source using [Cargo](https://github.com/rust-lang/cargo):
4343

4444
```bash
45-
# Clone the source.
46-
git clone https://github.com/Blobfolio/fyi.git
47-
48-
# Go to it.
49-
cd fyi
50-
51-
# Build as usual. Specify additional flags as desired.
52-
cargo build \
53-
--bin fyi \
54-
--release
45+
# See "cargo install --help" for more options.
46+
cargo install \
47+
--git https://github.com/Blobfolio/fyi.git \
48+
--bin fyi
5549
```
5650

57-
(This should work under other 64-bit Unix environments too, like MacOS.)
58-
5951

6052

6153
## Usage

fyi/Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[package]
22
name = "fyi"
3-
version = "1.6.1"
3+
version = "1.7.0"
44
license = "WTFPL"
55
authors = ["Josh Stoik <josh@blobfolio.com>"]
6-
edition = "2021"
6+
edition = "2024"
77
description = "A dead-simple CLI status message printer for use in BASH scripts, etc."
88
repository = "https://github.com/Blobfolio/fyi"
99
publish = false
@@ -143,7 +143,7 @@ subcommands = [ "blank" ]
143143
[[package.metadata.bashman.options]]
144144
short = "-e"
145145
long = "--exit"
146-
description = "Exit with this status code after printing. [default: 0]"
146+
description = "Exit with this code (0-255) after printing. [default: 0]"
147147
label = "<NUM>"
148148
path = false
149149
subcommands = [ "print", "crunched", "debug", "done", "error", "info", "notice", "review", "skipped", "success", "task", "warning" ]
@@ -170,13 +170,13 @@ description = "The message!"
170170
subcommands = [ "confirm", "print", "crunched", "debug", "done", "error", "info", "notice", "review", "skipped", "success", "task", "warning" ]
171171

172172
[build-dependencies]
173-
argyle = "0.10.*"
173+
argyle = "0.11.*"
174174

175175
[build-dependencies.fyi_msg]
176176
path = "../fyi_msg"
177177

178178
[dependencies]
179-
argyle = "0.10.*"
179+
argyle = "0.11.*"
180180
dactyl = "0.9.*"
181181

182182
[dependencies.fyi_msg]

fyi/help/generic-bottom.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ FLAGS:
55
-t, --timestamp Include a timestamp.
66

77
OPTIONS:
8-
-e, --exit <num> Exit with this status code after printing. [default: 0]
8+
-e, --exit <num> Exit with this code (0-255) after printing. [default: 0]
99

1010
ARGS:
1111
<MSG> The message!

fyi/help/print.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ FLAGS:
1010
-t, --timestamp Include a timestamp.
1111

1212
OPTIONS:
13-
-e, --exit <num> Exit with this status code after printing. [default: 0]
13+
-e, --exit <num> Exit with this code (0-255) after printing.
14+
[default: 0]
1415
-p, --prefix <txt> Set a custom prefix. [default: ]
1516
-c, --prefix-color <num> Use this color for the prefix. [default: 199]
1617

fyi/src/cli.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ use argyle::{
77
Argument,
88
};
99
use crate::FyiError;
10-
use dactyl::traits::{
11-
BytesToSigned,
12-
BytesToUnsigned,
13-
};
10+
use dactyl::traits::BytesToUnsigned;
1411
use fyi_msg::{
1512
Msg,
1613
MsgKind,
1714
};
18-
use std::num::NonZeroUsize;
15+
use std::{
16+
num::NonZeroUsize,
17+
process::ExitCode,
18+
};
1919

2020

2121

@@ -29,7 +29,7 @@ pub(super) struct Settings {
2929
flags: u8,
3030

3131
/// # Exit.
32-
exit: i32,
32+
exit: ExitCode,
3333
}
3434

3535
impl Settings {
@@ -46,8 +46,8 @@ impl Settings {
4646
const FLAG_YES: u8 = 0b1000;
4747

4848
/// # Exit Code.
49-
pub(super) const fn exit(self) -> Result<(), FyiError> {
50-
if self.exit == 0 { Ok(()) }
49+
pub(super) fn exit(self) -> Result<(), FyiError> {
50+
if self.exit == ExitCode::SUCCESS { Ok(()) }
5151
else { Err(FyiError::Passthrough(self.exit)) }
5252
}
5353

@@ -75,7 +75,7 @@ impl Settings {
7575

7676
/// # New.
7777
const fn new() -> Self {
78-
Self { flags: 0, exit: 0 }
78+
Self { flags: 0, exit: ExitCode::SUCCESS }
7979
}
8080

8181
/// # Set Indent.
@@ -164,7 +164,7 @@ pub(super) fn parse_msg(kind: MsgKind) -> Result<(Msg, Settings), FyiError> {
164164
if let Some(s) = u8::btou(s.trim().as_bytes()) { color = s; },
165165
Argument::KeyWithValue("-p" | "--prefix", s) => { prefix = s; },
166166
Argument::KeyWithValue("-e" | "--exit", s) =>
167-
if let Some(s) = i32::btoi(s.trim().as_bytes()) { flags.exit = s; },
167+
if let Some(s) = u8::btou(s.trim().as_bytes()) { flags.exit = s.into(); },
168168

169169
Argument::Other(s) =>
170170
if msg.is_none() { msg.replace(s); }

fyi/src/error.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@
33
*/
44

55
use fyi_msg::MsgKind;
6-
use std::fmt;
6+
use std::{
7+
fmt,
8+
process::ExitCode,
9+
};
710

811

912

10-
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
13+
#[derive(Debug, Clone, Copy, PartialEq)]
1114
/// # Errors!
1215
pub(super) enum FyiError {
1316
/// # Unrecognized CLI.
@@ -17,7 +20,7 @@ pub(super) enum FyiError {
1720
NoMessage,
1821

1922
/// # Passthrough.
20-
Passthrough(i32),
23+
Passthrough(ExitCode),
2124

2225
/// # Print Help (Not an Error).
2326
PrintHelp(MsgKind),
@@ -52,13 +55,4 @@ impl FyiError {
5255
Self::PrintVersion => concat!("FYI v", env!("CARGO_PKG_VERSION")),
5356
}
5457
}
55-
56-
/// # Exit Code.
57-
pub(super) const fn exit_code(self) -> i32 {
58-
match self {
59-
Self::Passthrough(e) => e,
60-
Self::PrintHelp(_) | Self::PrintVersion => 0,
61-
_ => 1,
62-
}
63-
}
6458
}

fyi/src/main.rs

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -63,22 +63,27 @@ use fyi_msg::{
6363
Msg,
6464
MsgKind,
6565
};
66+
use std::process::ExitCode;
6667

6768

6869

6970
/// # Main.
70-
fn main() {
71-
// Handle errors.
72-
if let Err(e) = main__() {
73-
match e {
74-
FyiError::Passthrough(_) => {},
75-
FyiError::PrintHelp(x) => return helper(x),
76-
FyiError::PrintVersion => { println!("{}", FyiError::PrintVersion); },
77-
_ => { Msg::error(e.to_string()).eprint(); },
78-
}
79-
80-
let code = e.exit_code();
81-
if code != 0 { std::process::exit(code); }
71+
fn main() -> ExitCode {
72+
match main__() {
73+
Ok(()) => ExitCode::SUCCESS,
74+
Err(FyiError::PrintHelp(x)) => {
75+
helper(x);
76+
ExitCode::SUCCESS
77+
},
78+
Err(FyiError::PrintVersion) => {
79+
println!("{}", FyiError::PrintVersion);
80+
ExitCode::SUCCESS
81+
},
82+
Err(FyiError::Passthrough(e)) => e,
83+
Err(e) => {
84+
Msg::error(e.to_string()).eprint();
85+
ExitCode::FAILURE
86+
},
8287
}
8388
}
8489

@@ -95,7 +100,7 @@ fn main__() -> Result<(), FyiError> {
95100
if matches!(kind, MsgKind::Confirm) {
96101
return
97102
if msg.prompt_with_default(flags.yes()) { Ok(()) }
98-
else { Err(FyiError::Passthrough(1)) };
103+
else { Err(FyiError::Passthrough(ExitCode::FAILURE)) };
99104
}
100105

101106
// Print to `STDERR`.

fyi_msg/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[package]
22
name = "fyi_msg"
3-
version = "1.6.1"
3+
version = "1.7.0"
44
authors = ["Josh Stoik <josh@blobfolio.com>"]
5-
edition = "2021"
6-
rust-version = "1.83"
5+
edition = "2024"
6+
rust-version = "1.85"
77
description = "Simple ANSI-formatted, prefixed messages for console printing."
88
license = "WTFPL"
99
repository = "https://github.com/Blobfolio/fyi"

0 commit comments

Comments
 (0)