Skip to content

Commit 059e9ea

Browse files
committed
release: 0.3.16
2 parents a3dd379 + 69df4e5 commit 059e9ea

File tree

7 files changed

+61
-33
lines changed

7 files changed

+61
-33
lines changed

CREDITS.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# Project Dependencies
22
Package: cargo-bashman
3-
Version: 0.3.15
4-
Generated: 2022-12-15 17:46:38 UTC
3+
Version: 0.3.16
4+
Generated: 2022-12-26 19:47:30 UTC
55

66
| Package | Version | Author(s) | License |
77
| ---- | ---- | ---- | ---- |
88
| [adbyss_psl](https://github.com/Blobfolio/adbyss) | 0.7.16 | [Josh Stoik](mailto:[email protected]) | WTFPL |
99
| [ahash](https://github.com/tkaitchuck/ahash) | 0.8.2 | [Tom Kaitchuck](mailto:[email protected]) | Apache-2.0 or MIT |
1010
| [argyle](https://github.com/Blobfolio/argyle) | 0.6.3 | [Blobfolio, LLC.](mailto:[email protected]) | WTFPL |
11-
| [bashman_core](https://github.com/Blobfolio/bashman) | 0.3.15 | [Josh Stoik](mailto:[email protected]) | WTFPL |
11+
| [bashman_core](https://github.com/Blobfolio/bashman) | 0.3.16 | [Josh Stoik](mailto:[email protected]) | WTFPL |
1212
| [camino](https://github.com/camino-rs/camino) | 1.1.1 | [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 |
1313
| [cargo-platform](https://github.com/rust-lang/cargo) | 0.1.2 | The Cargo Project Developers | Apache-2.0 or MIT |
1414
| [cargo_metadata](https://github.com/oli-obk/cargo_metadata) | 0.15.2 | [Oliver Schneider](mailto:[email protected]) | MIT |
@@ -17,26 +17,26 @@
1717
| [fyi_msg](https://github.com/Blobfolio/fyi) | 0.10.3 | [Blobfolio, LLC.](mailto:[email protected]) | WTFPL |
1818
| [hashbrown](https://github.com/rust-lang/hashbrown) | 0.12.3 | [Amanieu d'Antras](mailto:[email protected]) | Apache-2.0 or MIT |
1919
| [indexmap](https://github.com/bluss/indexmap) | 1.9.2 | | Apache-2.0 or MIT |
20-
| [itoa](https://github.com/dtolnay/itoa) | 1.0.4 | [David Tolnay](mailto:[email protected]) | Apache-2.0 or MIT |
20+
| [itoa](https://github.com/dtolnay/itoa) | 1.0.5 | [David Tolnay](mailto:[email protected]) | Apache-2.0 or MIT |
2121
| [libdeflate-sys](https://github.com/adamkewley/libdeflater) | 0.11.0 | [Adam Kewley](mailto:[email protected]) | Apache-2.0 |
2222
| [libdeflater](https://github.com/adamkewley/libdeflater) | 0.11.0 | [Adam Kewley](mailto:[email protected]) | Apache-2.0 |
2323
| [num-traits](https://github.com/rust-num/num-traits) | 0.2.15 | The Rust Project Developers | Apache-2.0 or MIT |
2424
| [oxford_join](https://github.com/Blobfolio/oxford_join) | 0.2.5 | [Blobfolio, LLC.](mailto:[email protected]) | WTFPL |
25-
| [proc-macro2](https://github.com/dtolnay/proc-macro2) | 1.0.47 | [David Tolnay](mailto:[email protected]) and [Alex Crichton](mailto:[email protected]) | Apache-2.0 or MIT |
26-
| [quote](https://github.com/dtolnay/quote) | 1.0.21 | [David Tolnay](mailto:[email protected]) | Apache-2.0 or MIT |
27-
| [ryu](https://github.com/dtolnay/ryu) | 1.0.11 | [David Tolnay](mailto:[email protected]) | Apache-2.0 or BSL-1.0 |
28-
| [semver](https://github.com/dtolnay/semver) | 1.0.14 | [David Tolnay](mailto:[email protected]) | Apache-2.0 or MIT |
29-
| [serde](https://github.com/serde-rs/serde) | 1.0.150 | [Erick Tryzelaar](mailto:[email protected]) and [David Tolnay](mailto:[email protected]) | Apache-2.0 or MIT |
30-
| [serde_derive](https://github.com/serde-rs/serde) | 1.0.150 | [Erick Tryzelaar](mailto:[email protected]) and [David Tolnay](mailto:[email protected]) | Apache-2.0 or MIT |
31-
| [serde_json](https://github.com/serde-rs/json) | 1.0.89 | [Erick Tryzelaar](mailto:[email protected]) and [David Tolnay](mailto:[email protected]) | Apache-2.0 or MIT |
32-
| [syn](https://github.com/dtolnay/syn) | 1.0.105 | [David Tolnay](mailto:[email protected]) | Apache-2.0 or MIT |
33-
| [thiserror](https://github.com/dtolnay/thiserror) | 1.0.37 | [David Tolnay](mailto:[email protected]) | Apache-2.0 or MIT |
34-
| [thiserror-impl](https://github.com/dtolnay/thiserror) | 1.0.37 | [David Tolnay](mailto:[email protected]) | Apache-2.0 or MIT |
25+
| [proc-macro2](https://github.com/dtolnay/proc-macro2) | 1.0.49 | [David Tolnay](mailto:[email protected]) and [Alex Crichton](mailto:[email protected]) | Apache-2.0 or MIT |
26+
| [quote](https://github.com/dtolnay/quote) | 1.0.23 | [David Tolnay](mailto:[email protected]) | Apache-2.0 or MIT |
27+
| [ryu](https://github.com/dtolnay/ryu) | 1.0.12 | [David Tolnay](mailto:[email protected]) | Apache-2.0 or BSL-1.0 |
28+
| [semver](https://github.com/dtolnay/semver) | 1.0.16 | [David Tolnay](mailto:[email protected]) | Apache-2.0 or MIT |
29+
| [serde](https://github.com/serde-rs/serde) | 1.0.152 | [Erick Tryzelaar](mailto:[email protected]) and [David Tolnay](mailto:[email protected]) | Apache-2.0 or MIT |
30+
| [serde_derive](https://github.com/serde-rs/serde) | 1.0.152 | [Erick Tryzelaar](mailto:[email protected]) and [David Tolnay](mailto:[email protected]) | Apache-2.0 or MIT |
31+
| [serde_json](https://github.com/serde-rs/json) | 1.0.91 | [Erick Tryzelaar](mailto:[email protected]) and [David Tolnay](mailto:[email protected]) | Apache-2.0 or MIT |
32+
| [syn](https://github.com/dtolnay/syn) | 1.0.107 | [David Tolnay](mailto:[email protected]) | Apache-2.0 or MIT |
33+
| [thiserror](https://github.com/dtolnay/thiserror) | 1.0.38 | [David Tolnay](mailto:[email protected]) | Apache-2.0 or MIT |
34+
| [thiserror-impl](https://github.com/dtolnay/thiserror) | 1.0.38 | [David Tolnay](mailto:[email protected]) | Apache-2.0 or MIT |
3535
| [tinyvec](https://github.com/Lokathor/tinyvec) | 1.6.0 | [Lokathor](mailto:[email protected]) | Apache-2.0, MIT, or Zlib |
3636
| [tinyvec_macros](https://github.com/Soveu/tinyvec_macros) | 0.1.0 | [Soveu](mailto:[email protected]) | Apache-2.0, MIT, or Zlib |
3737
| [toml](https://github.com/toml-rs/toml) | 0.5.10 | [Alex Crichton](mailto:[email protected]) | Apache-2.0 or MIT |
3838
| [trimothy](https://github.com/Blobfolio/trimothy) | 0.1.4 | [Blobfolio, LLC.](mailto:[email protected]) | WTFPL |
3939
| [unicode-bidi](https://github.com/servo/unicode-bidi) | 0.3.8 | The Servo Project Developers | Apache-2.0 or MIT |
40-
| [unicode-ident](https://github.com/dtolnay/unicode-ident) | 1.0.5 | [David Tolnay](mailto:[email protected]) | Apache-2.0 AND Unicode-DFS-2016 or MIT |
40+
| [unicode-ident](https://github.com/dtolnay/unicode-ident) | 1.0.6 | [David Tolnay](mailto:[email protected]) | Apache-2.0 AND Unicode-DFS-2016 or MIT |
4141
| [unicode-normalization](https://github.com/unicode-rs/unicode-normalization) | 0.1.22 | [kwantam](mailto:[email protected]) and [Manish Goregaokar](mailto:[email protected]) | Apache-2.0 or MIT |
4242
| [utc2k](https://github.com/Blobfolio/utc2k) | 0.5.10 | [Blobfolio, LLC.](mailto:[email protected]) | WTFPL |

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Cargo BashMan
22

3-
[![ci](https://img.shields.io/github/workflow/status/Blobfolio/bashman/Build.svg?style=flat-square&label=ci)](https://github.com/Blobfolio/bashman/actions)
3+
[![ci](https://img.shields.io/github/actions/workflow/status/Blobfolio/bashman/ci.yaml?style=flat-square&label=ci)](https://github.com/Blobfolio/bashman/actions)
44
[![deps.rs](https://deps.rs/repo/github/blobfolio/bashman/status.svg?style=flat-square&label=deps.rs)](https://deps.rs/repo/github/blobfolio/bashman)<br>
55
[![license](https://img.shields.io/badge/license-wtfpl-ff1493?style=flat-square)](https://en.wikipedia.org/wiki/WTFPL)
66
[![contributions welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square&label=contributions)](https://github.com/Blobfolio/bashman/issues)
@@ -120,6 +120,7 @@ Switches have the following fields:
120120
| short | *string* | A short key, like `-h`. |
121121
| long | *string* | A long key, like `--help`. |
122122
| description | *string* | A description for the flag. |
123+
| duplicate | *bool* | If `true`, the BASH completions will suggest this switch even if already present (so i.e. it can be supplied more than once). |
123124
| subcommands | *array* | If this switch applies to one or more subcommands, list the commands here. If a switch applies to the top-level app, omit this field, or include an empty `""` entry in the array. |
124125

125126
Example:
@@ -147,6 +148,7 @@ An "option" is exactly like a "switch", except it takes a value. As such, they h
147148
| long | *string* | A long key, like `--help`. |
148149
| description | *string* | A description for the flag. |
149150
| label | *string* | A placeholder label for the value bit, like `<FILE>`. |
151+
| duplicate | *bool* | If `true`, the BASH completions will suggest this option even if already present (so i.e. it can be supplied more than once). |
150152
| path | *bool* | If `true`, the BASH completions will suggest files/directories as potential values. If `false`, no value suggestion will be hazarded. |
151153
| subcommands | *array* | If this option applies to one or more subcommands, list the commands here. If an option applies to the top-level app, omit this field, or include an empty `""` entry in the array. |
152154

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

bashman_core/src/data.rs

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -665,11 +665,13 @@ impl<'a> DataKind<'a> {
665665
buf,
666666
s.short,
667667
s.long,
668+
s.duplicate,
668669
),
669670
Self::Option(s) => bash_long_short_conds(
670671
buf,
671672
s.flag.short,
672673
s.flag.long,
674+
s.flag.duplicate,
673675
),
674676
Self::SubCommand(s) => writeln!(buf, "\topts+=(\"{}\")", s.bin)
675677
.map_err(|_| BashManError::WriteBash),
@@ -750,6 +752,7 @@ pub(super) struct DataFlag<'a> {
750752
pub(crate) short: Option<&'a str>,
751753
pub(crate) long: Option<&'a str>,
752754
pub(crate) description: &'a str,
755+
pub(crate) duplicate: bool,
753756
}
754757

755758

@@ -800,25 +803,40 @@ fn bash_subfname(parent: &[u8], bin: &[u8]) -> Box<str> {
800803
fn bash_long_short_conds(
801804
buf: &mut Vec<u8>,
802805
short: Option<&str>,
803-
long: Option<&str>
806+
long: Option<&str>,
807+
duplicate: bool,
804808
) -> Result<(), BashManError> {
805809
match (short, long) {
806-
(Some(s), Some(l)) => write!(
807-
buf,
808-
r#" if [[ ! " ${{COMP_LINE}} " =~ " {short} " ]] && [[ ! " ${{COMP_LINE}} " =~ " {long} " ]]; then
810+
(Some(s), Some(l)) =>
811+
if duplicate {
812+
writeln!(
813+
buf,
814+
"\topts+=(\"{short}\")\n\topts+=(\"{long}\")",
815+
short=s,
816+
long=l,
817+
)
818+
}
819+
else {
820+
write!(
821+
buf,
822+
r#" if [[ ! " ${{COMP_LINE}} " =~ " {short} " ]] && [[ ! " ${{COMP_LINE}} " =~ " {long} " ]]; then
809823
opts+=("{short}")
810824
opts+=("{long}")
811825
fi
812826
"#,
813-
short=s,
814-
long=l
815-
)
827+
short=s,
828+
long=l
829+
)
830+
}
816831
.map_err(|_| BashManError::WriteBash),
817-
(None, Some(k)) | (Some(k), None) => writeln!(
818-
buf,
819-
"\t[[ \" ${{COMP_LINE}} \" =~ \" {key} \" ]] || opts+=(\"{key}\")",
820-
key=k
821-
)
832+
(None, Some(k)) | (Some(k), None) =>
833+
if duplicate { writeln!(buf, "\topts+=(\"{k}\")") }
834+
else {
835+
writeln!(
836+
buf,
837+
"\t[[ \" ${{COMP_LINE}} \" =~ \" {k} \" ]] || opts+=(\"{k}\")",
838+
)
839+
}
822840
.map_err(|_| BashManError::WriteBash),
823841
(None, None) => Ok(()),
824842
}

bashman_core/src/raw.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,9 @@ struct RawSwitch<'a> {
290290
#[serde(deserialize_with = "deserialize_nonempty_str")]
291291
description: &'a str,
292292

293+
#[serde(default)]
294+
duplicate: bool,
295+
293296
#[serde(default)]
294297
subcommands: Vec<&'a str>,
295298
}
@@ -319,6 +322,9 @@ struct RawOption<'a> {
319322
#[serde(default)]
320323
path: bool,
321324

325+
#[serde(default)]
326+
duplicate: bool,
327+
322328
#[serde(default)]
323329
subcommands: Vec<&'a str>,
324330
}
@@ -483,6 +489,7 @@ impl<'a> TryFrom<&'a RawSwitch<'a>> for DataKind<'a> {
483489
short: src.short,
484490
long: src.long,
485491
description: src.description,
492+
duplicate: src.duplicate,
486493
}
487494
))
488495
}
@@ -503,9 +510,10 @@ impl<'a> TryFrom<&'a RawOption<'a>> for DataKind<'a> {
503510
short: src.short,
504511
long: src.long,
505512
description: src.description,
513+
duplicate: src.duplicate,
506514
},
507515
label: src.label.unwrap_or("<VAL>"),
508-
path: src.path
516+
path: src.path,
509517
}
510518
))
511519
}

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

0 commit comments

Comments
 (0)