Skip to content

Commit 4ccc774

Browse files
committed
release: 0.4.9
2 parents 87381c4 + 3bbffe0 commit 4ccc774

File tree

6 files changed

+88
-44
lines changed

6 files changed

+88
-44
lines changed

CREDITS.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
# Project Dependencies
22
Package: cargo-bashman
3-
Version: 0.4.8
4-
Generated: 2024-09-05 20:25:01 UTC
3+
Version: 0.4.9
4+
Generated: 2024-10-08 07:33:21 UTC
55

66
| Package | Version | Author(s) | License |
77
| ---- | ---- | ---- | ---- |
88
| [adbyss_psl](https://github.com/Blobfolio/adbyss) | 0.13.0 | [Josh Stoik](mailto:[email protected]) | WTFPL |
99
| [adler2](https://github.com/oyvindln/adler2) | 2.0.0 | [Jonas Schievink](mailto:[email protected]) and [oyvindln](mailto:[email protected]) | 0BSD, Apache-2.0, or MIT |
1010
| [ahash](https://github.com/tkaitchuck/ahash) | 0.8.11 | [Tom Kaitchuck](mailto:[email protected]) | Apache-2.0 or MIT |
1111
| [argyle](https://github.com/Blobfolio/argyle) | 0.8.1 | [Blobfolio, LLC.](mailto:[email protected]) | WTFPL |
12-
| [bashman_core](https://github.com/Blobfolio/bashman) | 0.4.8 | [Josh Stoik](mailto:[email protected]) | WTFPL |
12+
| [bashman_core](https://github.com/Blobfolio/bashman) | 0.4.9 | [Josh Stoik](mailto:[email protected]) | WTFPL |
1313
| [camino](https://github.com/camino-rs/camino) | 1.1.9 | [Without Boats](mailto:[email protected]), [Ashley Williams](mailto:[email protected]), [Steve Klabnik](mailto:[email protected]), and [Rain](mailto:[email protected]) | 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:[email protected]) | MIT |
1616
| [cfg-if](https://github.com/alexcrichton/cfg-if) | 1.0.0 | [Alex Crichton](mailto:[email protected]) | Apache-2.0 or MIT |
1717
| [crc32fast](https://github.com/srijs/rust-crc32fast) | 1.4.2 | [Sam Rijs](mailto:[email protected]) and [Alex Crichton](mailto:[email protected]) | Apache-2.0 or MIT |
18-
| [dactyl](https://github.com/Blobfolio/dactyl) | 0.7.3 | [Blobfolio, LLC.](mailto:[email protected]) | WTFPL |
18+
| [dactyl](https://github.com/Blobfolio/dactyl) | 0.7.4 | [Blobfolio, LLC.](mailto:[email protected]) | WTFPL |
1919
| [displaydoc](https://github.com/yaahc/displaydoc) | 0.2.5 | [Jane Lusby](mailto:[email protected]) | Apache-2.0 or MIT |
2020
| [equivalent](https://github.com/cuviper/equivalent) | 1.0.1 | | Apache-2.0 or MIT |
21-
| [flate2](https://github.com/rust-lang/flate2-rs) | 1.0.33 | [Alex Crichton](mailto:[email protected]) and [Josh Triplett](mailto:[email protected]) | Apache-2.0 or MIT |
22-
| [fyi_msg](https://github.com/Blobfolio/fyi) | 0.14.0 | [Blobfolio, LLC.](mailto:[email protected]) | WTFPL |
23-
| [hashbrown](https://github.com/rust-lang/hashbrown) | 0.14.5 | [Amanieu d'Antras](mailto:[email protected]) | Apache-2.0 or MIT |
21+
| [flate2](https://github.com/rust-lang/flate2-rs) | 1.0.34 | [Alex Crichton](mailto:[email protected]) and [Josh Triplett](mailto:[email protected]) | Apache-2.0 or MIT |
22+
| [fyi_msg](https://github.com/Blobfolio/fyi) | 0.14.1 | [Blobfolio, LLC.](mailto:[email protected]) | WTFPL |
23+
| [hashbrown](https://github.com/rust-lang/hashbrown) | 0.15.0 | [Amanieu d'Antras](mailto:[email protected]) | Apache-2.0 or MIT |
2424
| [icu_collections](https://github.com/unicode-org/icu4x) | 1.5.0 | The ICU4X Project Developers | Unicode-3.0 |
2525
| [icu_locid](https://github.com/unicode-org/icu4x) | 1.5.0 | The ICU4X Project Developers | Unicode-3.0 |
2626
| [icu_locid_transform](https://github.com/unicode-org/icu4x) | 1.5.0 | The ICU4X Project Developers | Unicode-3.0 |
@@ -32,36 +32,36 @@
3232
| [icu_provider](https://github.com/unicode-org/icu4x) | 1.5.0 | The ICU4X Project Developers | Unicode-3.0 |
3333
| [icu_provider_macros](https://github.com/unicode-org/icu4x) | 1.5.0 | The ICU4X Project Developers | Unicode-3.0 |
3434
| [idna](https://github.com/servo/rust-url/) | 1.0.2 | The rust-url developers | Apache-2.0 or MIT |
35-
| [indexmap](https://github.com/indexmap-rs/indexmap) | 2.5.0 | | Apache-2.0 or MIT |
35+
| [indexmap](https://github.com/indexmap-rs/indexmap) | 2.6.0 | | Apache-2.0 or MIT |
3636
| [itoa](https://github.com/dtolnay/itoa) | 1.0.11 | [David Tolnay](mailto:[email protected]) | Apache-2.0 or MIT |
3737
| [litemap](https://github.com/unicode-org/icu4x) | 0.7.3 | The ICU4X Project Developers | Unicode-3.0 |
3838
| [memchr](https://github.com/BurntSushi/memchr) | 2.7.4 | [Andrew Gallant](mailto:[email protected]) and bluss | MIT or Unlicense |
3939
| [miniz_oxide](https://github.com/Frommi/miniz_oxide/tree/master/miniz_oxide) | 0.8.0 | [Frommi](mailto:[email protected]) and [oyvindln](mailto:[email protected]) | Apache-2.0, MIT, or Zlib |
40-
| [oxford_join](https://github.com/Blobfolio/oxford_join) | 0.2.10 | [Blobfolio, LLC.](mailto:[email protected]) | WTFPL |
41-
| [proc-macro2](https://github.com/dtolnay/proc-macro2) | 1.0.86 | [David Tolnay](mailto:[email protected]) and [Alex Crichton](mailto:[email protected]) | Apache-2.0 or MIT |
40+
| [oxford_join](https://github.com/Blobfolio/oxford_join) | 0.4.0 | [Blobfolio, LLC.](mailto:[email protected]) | WTFPL |
41+
| [proc-macro2](https://github.com/dtolnay/proc-macro2) | 1.0.87 | [David Tolnay](mailto:[email protected]) and [Alex Crichton](mailto:[email protected]) | Apache-2.0 or MIT |
4242
| [quote](https://github.com/dtolnay/quote) | 1.0.37 | [David Tolnay](mailto:[email protected]) | Apache-2.0 or MIT |
4343
| [ryu](https://github.com/dtolnay/ryu) | 1.0.18 | [David Tolnay](mailto:[email protected]) | Apache-2.0 or BSL-1.0 |
4444
| [semver](https://github.com/dtolnay/semver) | 1.0.23 | [David Tolnay](mailto:[email protected]) | Apache-2.0 or MIT |
45-
| [serde](https://github.com/serde-rs/serde) | 1.0.209 | [Erick Tryzelaar](mailto:[email protected]) and [David Tolnay](mailto:[email protected]) | Apache-2.0 or MIT |
46-
| [serde_derive](https://github.com/serde-rs/serde) | 1.0.209 | [Erick Tryzelaar](mailto:[email protected]) and [David Tolnay](mailto:[email protected]) | Apache-2.0 or MIT |
45+
| [serde](https://github.com/serde-rs/serde) | 1.0.210 | [Erick Tryzelaar](mailto:[email protected]) and [David Tolnay](mailto:[email protected]) | Apache-2.0 or MIT |
46+
| [serde_derive](https://github.com/serde-rs/serde) | 1.0.210 | [Erick Tryzelaar](mailto:[email protected]) and [David Tolnay](mailto:[email protected]) | Apache-2.0 or MIT |
4747
| [serde_json](https://github.com/serde-rs/json) | 1.0.128 | [Erick Tryzelaar](mailto:[email protected]) and [David Tolnay](mailto:[email protected]) | Apache-2.0 or MIT |
48-
| [serde_spanned](https://github.com/toml-rs/toml) | 0.6.7 | | Apache-2.0 or MIT |
48+
| [serde_spanned](https://github.com/toml-rs/toml) | 0.6.8 | | Apache-2.0 or MIT |
4949
| [smallvec](https://github.com/servo/rust-smallvec) | 1.13.2 | The Servo Project Developers | Apache-2.0 or MIT |
5050
| [stable_deref_trait](https://github.com/storyyeller/stable_deref_trait) | 1.2.0 | [Robert Grosse](mailto:[email protected]) | Apache-2.0 or MIT |
51-
| [syn](https://github.com/dtolnay/syn) | 2.0.77 | [David Tolnay](mailto:[email protected]) | Apache-2.0 or MIT |
51+
| [syn](https://github.com/dtolnay/syn) | 2.0.79 | [David Tolnay](mailto:[email protected]) | Apache-2.0 or MIT |
5252
| [synstructure](https://github.com/mystor/synstructure) | 0.13.1 | [Nika Layzell](mailto:[email protected]) | MIT |
53-
| [thiserror](https://github.com/dtolnay/thiserror) | 1.0.63 | [David Tolnay](mailto:[email protected]) | Apache-2.0 or MIT |
54-
| [thiserror-impl](https://github.com/dtolnay/thiserror) | 1.0.63 | [David Tolnay](mailto:[email protected]) | Apache-2.0 or MIT |
53+
| [thiserror](https://github.com/dtolnay/thiserror) | 1.0.64 | [David Tolnay](mailto:[email protected]) | Apache-2.0 or MIT |
54+
| [thiserror-impl](https://github.com/dtolnay/thiserror) | 1.0.64 | [David Tolnay](mailto:[email protected]) | Apache-2.0 or MIT |
5555
| [tinystr](https://github.com/unicode-org/icu4x) | 0.7.6 | The ICU4X Project Developers | Unicode-3.0 |
5656
| [toml](https://github.com/toml-rs/toml) | 0.8.19 | [Alex Crichton](mailto:[email protected]) | Apache-2.0 or MIT |
5757
| [toml_datetime](https://github.com/toml-rs/toml) | 0.6.8 | [Alex Crichton](mailto:[email protected]) | Apache-2.0 or MIT |
58-
| [toml_edit](https://github.com/toml-rs/toml) | 0.22.20 | [Andronik Ordian](mailto:[email protected]) and [Ed Page](mailto:[email protected]) | Apache-2.0 or MIT |
58+
| [toml_edit](https://github.com/toml-rs/toml) | 0.22.22 | [Andronik Ordian](mailto:[email protected]) and [Ed Page](mailto:[email protected]) | Apache-2.0 or MIT |
5959
| [trimothy](https://github.com/Blobfolio/trimothy) | 0.3.1 | [Blobfolio, LLC.](mailto:[email protected]) | WTFPL |
60-
| [unicode-ident](https://github.com/dtolnay/unicode-ident) | 1.0.12 | [David Tolnay](mailto:[email protected]) | Apache-2.0 AND Unicode-DFS-2016 or MIT |
61-
| [utc2k](https://github.com/Blobfolio/utc2k) | 0.9.1 | [Blobfolio, LLC.](mailto:[email protected]) | WTFPL |
60+
| [unicode-ident](https://github.com/dtolnay/unicode-ident) | 1.0.13 | [David Tolnay](mailto:[email protected]) | Apache-2.0 AND Unicode-DFS-2016 or MIT |
61+
| [utc2k](https://github.com/Blobfolio/utc2k) | 0.10.0 | [Blobfolio, LLC.](mailto:[email protected]) | WTFPL |
6262
| [utf16_iter](https://github.com/hsivonen/utf16_iter) | 1.0.5 | [Henri Sivonen](mailto:[email protected]) | Apache-2.0 or MIT |
6363
| [utf8_iter](https://github.com/hsivonen/utf8_iter) | 1.0.4 | [Henri Sivonen](mailto:[email protected]) | Apache-2.0 or MIT |
64-
| [winnow](https://github.com/winnow-rs/winnow) | 0.6.18 | | MIT |
64+
| [winnow](https://github.com/winnow-rs/winnow) | 0.6.20 | | MIT |
6565
| [write16](https://github.com/hsivonen/write16) | 1.0.0 | | Apache-2.0 or MIT |
6666
| [writeable](https://github.com/unicode-org/icu4x) | 0.5.5 | The ICU4X Project Developers | Unicode-3.0 |
6767
| [yoke](https://github.com/unicode-org/icu4x) | 0.7.4 | [Manish Goregaokar](mailto:[email protected]) | Unicode-3.0 |

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.8"
3+
version = "0.4.9"
44
license = "WTFPL"
55
authors = ["Josh Stoik <[email protected]>"]
66
edition = "2021"

bashman_core/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "bashman_core"
3-
version = "0.4.8"
3+
version = "0.4.9"
44
license = "WTFPL"
55
authors = ["Josh Stoik <[email protected]>"]
66
edition = "2021"
@@ -14,10 +14,10 @@ argyle = "0.8.*"
1414
cargo_metadata = "=0.18.1"
1515
flate2 = "1.0.*"
1616
fyi_msg = "0.14.*"
17-
indexmap = "2.5.*"
18-
oxford_join = "0.2.*"
17+
indexmap = "2.6.*"
18+
oxford_join = "0.4.*"
1919
trimothy = "0.3.*"
20-
utc2k = "0.9.*"
20+
utc2k = "0.10.*"
2121

2222
[dependencies.serde]
2323
version = "1.0.*"

bashman_core/src/data.rs

Lines changed: 60 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use flate2::{
1111
Compression,
1212
write::GzEncoder,
1313
};
14+
use oxford_join::JoinFmt;
1415
use std::{
1516
fs::File,
1617
io::Write,
@@ -228,15 +229,17 @@ impl<'a> Command<'a> {
228229
/// script for cases where the last option entered expects a path. It is
229230
/// integrated into the main [`Agree::bash`] output.
230231
fn bash_paths(&self, buf: &mut Vec<u8>) -> Result<(), BashManError> {
231-
let keys: Vec<&str> = self.data.iter()
232-
.filter_map(|o| o.and_path_option().and_then(|o| o.flag.short))
233-
.chain(
234-
self.data.iter()
235-
.filter_map(|o| o.and_path_option().and_then(|o| o.flag.long))
236-
)
232+
// Collect all the keys corresponding to path options.
233+
let mut keys: Vec<&str> = self.data.iter()
234+
.filter_map(DataKind::and_path_option)
235+
.flat_map(|o| o.flag.keys())
237236
.collect();
238237

238+
// If there are any, add them to the completions.
239239
if ! keys.is_empty() {
240+
keys.sort_unstable();
241+
keys.dedup();
242+
240243
write!(
241244
buf,
242245
r#" case "${{prev}}" in
@@ -253,7 +256,7 @@ impl<'a> Command<'a> {
253256
;;
254257
esac
255258
"#,
256-
&keys.join("|")
259+
JoinFmt::new(keys.iter(), "|"),
257260
)
258261
.map_err(|_| BashManError::WriteBash)?;
259262
}
@@ -734,15 +737,9 @@ impl<'a> DataKind<'a> {
734737
}
735738

736739
match self {
737-
Self::Switch(i) => {
738-
push_desc!(i.description);
739-
},
740-
Self::Option(i) => {
741-
push_desc!(i.flag.description);
742-
},
743-
Self::Arg(i) | Self::Item(i) => {
744-
push_desc!(i.description);
745-
},
740+
Self::Switch(i) => { push_desc!(i.description); },
741+
Self::Option(i) => { push_desc!(i.flag.description); },
742+
Self::Arg(i) | Self::Item(i) => { push_desc!(i.description); },
746743
Self::Paragraph(i) => {
747744
if indent {
748745
buf.extend_from_slice(b"\n.TP\n");
@@ -799,6 +796,53 @@ pub(super) struct DataFlag<'a> {
799796
pub(crate) duplicate: bool,
800797
}
801798

799+
impl<'a> DataFlag<'a> {
800+
/// # Keys.
801+
const fn keys(&self) -> DataFlagKeys {
802+
DataFlagKeys {
803+
short: self.short,
804+
long: self.long,
805+
}
806+
}
807+
}
808+
809+
810+
811+
/// # Data Flag Iterator.
812+
///
813+
/// Iterate over the flag keys, if any, beginning with the shorter of the two.
814+
struct DataFlagKeys<'a> {
815+
/// # Short Key.
816+
short: Option<&'a str>,
817+
818+
/// # Long Key.
819+
long: Option<&'a str>,
820+
}
821+
822+
impl<'a> Iterator for DataFlagKeys<'a> {
823+
type Item = &'a str;
824+
825+
fn next(&mut self) -> Option<Self::Item> {
826+
self.short.take().or_else(|| self.long.take())
827+
}
828+
829+
fn size_hint(&self) -> (usize, Option<usize>) {
830+
let len = self.len();
831+
(len, Some(len))
832+
}
833+
}
834+
835+
impl<'a> ExactSizeIterator for DataFlagKeys<'a> {
836+
#[inline]
837+
fn len(&self) -> usize {
838+
match (self.short.is_some(), self.long.is_some()) {
839+
(true, true) => 2,
840+
(true, false) | (false, true) => 1,
841+
(false, false) => 0,
842+
}
843+
}
844+
}
845+
802846

803847

804848
#[derive(Debug, Copy, Clone)]

release/completions/cargo-bashman.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ _basher___cargo_bashman() {
2929
return 0
3030
fi
3131
case "${prev}" in
32-
-m|--manifest-path)
32+
--manifest-path|-m)
3333
if [ -z "$( declare -f _filedir )" ]; then
3434
COMPREPLY=( $( compgen -f "${cur}" ) )
3535
else

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" "September 2024" "Cargo BashMan v0.4.8" "User Commands"
1+
.TH "CARGO BASHMAN" "1" "October 2024" "Cargo BashMan v0.4.9" "User Commands"
22
.SH NAME
3-
Cargo BashMan \- Manual page for cargo\-bashman v0.4.8.
3+
Cargo BashMan \- Manual page for cargo\-bashman v0.4.9.
44
.SH DESCRIPTION
55
A Cargo plugin to generate BASH completions and MAN pages.
66
.SS USAGE:

0 commit comments

Comments
 (0)