Skip to content

Commit bcb7796

Browse files
committed
release: 0.5.0
2 parents 4ccc774 + 453d5d6 commit bcb7796

File tree

5 files changed

+41
-32
lines changed

5 files changed

+41
-32
lines changed

CREDITS.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# Project Dependencies
22
Package: cargo-bashman
3-
Version: 0.4.9
4-
Generated: 2024-10-08 07:33:21 UTC
3+
Version: 0.5.0
4+
Generated: 2024-10-08 19:58:02 UTC
55

66
| Package | Version | Author(s) | License |
77
| ---- | ---- | ---- | ---- |
88
| [adbyss_psl](https://github.com/Blobfolio/adbyss) | 0.13.0 | [Josh Stoik](mailto:josh@blobfolio.com) | WTFPL |
99
| [adler2](https://github.com/oyvindln/adler2) | 2.0.0 | [Jonas Schievink](mailto:jonasschievink@gmail.com) and [oyvindln](mailto:oyvindln@users.noreply.github.com) | 0BSD, Apache-2.0, or MIT |
1010
| [ahash](https://github.com/tkaitchuck/ahash) | 0.8.11 | [Tom Kaitchuck](mailto:tom.kaitchuck@gmail.com) | Apache-2.0 or MIT |
1111
| [argyle](https://github.com/Blobfolio/argyle) | 0.8.1 | [Blobfolio, LLC.](mailto:hello@blobfolio.com) | WTFPL |
12-
| [bashman_core](https://github.com/Blobfolio/bashman) | 0.4.9 | [Josh Stoik](mailto:josh@blobfolio.com) | WTFPL |
12+
| [bashman_core](https://github.com/Blobfolio/bashman) | 0.5.0 | [Josh Stoik](mailto:josh@blobfolio.com) | WTFPL |
1313
| [camino](https://github.com/camino-rs/camino) | 1.1.9 | [Without Boats](mailto:saoirse@without.boats), [Ashley Williams](mailto:ashley666ashley@gmail.com), [Steve Klabnik](mailto:steve@steveklabnik.com), and [Rain](mailto:rain@sunshowers.io) | Apache-2.0 or MIT |
1414
| [cargo-platform](https://github.com/rust-lang/cargo) | 0.1.8 | | Apache-2.0 or MIT |
1515
| [cargo_metadata](https://github.com/oli-obk/cargo_metadata) | 0.18.1 | [Oliver Schneider](mailto:git-spam-no-reply9815368754983@oli-obk.de) | MIT |

bashman/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "cargo-bashman"
3-
version = "0.4.9"
3+
version = "0.5.0"
44
license = "WTFPL"
55
authors = ["Josh Stoik <josh@blobfolio.com>"]
66
edition = "2021"

bashman_core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "bashman_core"
3-
version = "0.4.9"
3+
version = "0.5.0"
44
license = "WTFPL"
55
authors = ["Josh Stoik <josh@blobfolio.com>"]
66
edition = "2021"

bashman_core/src/data.rs

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use flate2::{
1313
};
1414
use oxford_join::JoinFmt;
1515
use std::{
16+
borrow::Cow,
1617
fs::File,
1718
io::Write,
1819
path::Path,
@@ -120,6 +121,26 @@ impl<'a> Command<'a> {
120121
/// # Description.
121122
const fn description(&self) -> &'a str { self.description }
122123

124+
/// # Full Bin.
125+
///
126+
/// Return either "bin" or "parent bin", depending on context.
127+
fn full_bin(&self) -> Cow<'a, str> {
128+
self.parent.map_or_else(
129+
|| Cow::Borrowed(self.bin()),
130+
|p| Cow::Owned(format!("{p} {}", self.bin())),
131+
)
132+
}
133+
134+
/// # Full Name.
135+
///
136+
/// Return either "name" or "parent name", depending on context.
137+
fn full_name(&self) -> Cow<'a, str> {
138+
self.parent.map_or_else(
139+
|| Cow::Borrowed(self.name()),
140+
|p| Cow::Owned(format!("{p} {}", self.name())),
141+
)
142+
}
143+
123144
#[must_use]
124145
/// # Name.
125146
const fn name(&self) -> &'a str { self.name }
@@ -408,27 +429,16 @@ impl<'a> Command<'a> {
408429
let now = utc2k::Utc2k::now();
409430

410431
// Start with the header.
411-
match self.parent {
412-
Some(p) => write!(
413-
buf,
414-
r#".TH "{} {}" "1" "{} {}" "{} v{}" "User Commands""#,
415-
p.to_uppercase(),
416-
self.name().to_uppercase(),
417-
now.month_name(),
418-
now.year(),
419-
self.name(),
420-
self.version(),
421-
),
422-
None => write!(
423-
buf,
424-
r#".TH "{}" "1" "{} {}" "{} v{}" "User Commands""#,
425-
self.name().to_uppercase(),
426-
now.month_name(),
427-
now.year(),
428-
self.name(),
429-
self.version(),
430-
),
431-
}
432+
let full_name = self.full_name();
433+
let full_bin = self.full_bin();
434+
write!(
435+
buf,
436+
r#".TH "{}" "1" "{} {}" "{full_bin} v{}" "User Commands""#,
437+
full_name.to_uppercase(),
438+
now.month_name(),
439+
now.year(),
440+
self.version(),
441+
)
432442
.map_err(|_| BashManError::WriteSubMan(Box::from(self.bin)))?;
433443

434444
/// # Helper: Generic section writer.
@@ -446,10 +456,9 @@ impl<'a> Command<'a> {
446456
"NAME",
447457
false,
448458
vec![DataKind::Paragraph(vec![&format!(
449-
"{} - Manual page for {} v{}.",
450-
self.name(),
451-
self.bin,
452-
self.version()
459+
"{} - Manual page for {full_bin} v{}.",
460+
self.name().to_uppercase(),
461+
self.version(),
453462
)])]
454463
);
455464

release/man/cargo-bashman.1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
.TH "CARGO BASHMAN" "1" "October 2024" "Cargo BashMan v0.4.9" "User Commands"
1+
.TH "CARGO BASHMAN" "1" "October 2024" "cargo\-bashman v0.5.0" "User Commands"
22
.SH NAME
3-
Cargo BashMan \- Manual page for cargo\-bashman v0.4.9.
3+
CARGO BASHMAN \- Manual page for cargo\-bashman v0.5.0.
44
.SH DESCRIPTION
55
A Cargo plugin to generate BASH completions and MAN pages.
66
.SS USAGE:

0 commit comments

Comments
 (0)