Skip to content

Commit 11a0785

Browse files
committed
release: 0.3.8
2 parents c08a183 + 06a364b commit 11a0785

File tree

9 files changed

+60
-20
lines changed

9 files changed

+60
-20
lines changed

CREDITS.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# Project Dependencies
22
Package: cargo-bashman
3-
Version: 0.3.7
4-
Generated: 2022-05-19 18:40:54 UTC
3+
Version: 0.3.8
4+
Generated: 2022-05-26 17:38:11 UTC
55

66
| Package | Version | Author(s) | License |
77
| ---- | ---- | ---- | ---- |
88
| [adbyss_psl](https://github.com/Blobfolio/adbyss) | 0.7.4 | [Josh Stoik](mailto:[email protected]) | WTFPL |
99
| [ahash](https://github.com/tkaitchuck/ahash) | 0.7.6 | [Tom Kaitchuck](mailto:[email protected]) | Apache-2.0 or MIT |
1010
| [argyle](https://github.com/Blobfolio/argyle) | 0.5.6 | [Blobfolio, LLC.](mailto:[email protected]) | WTFPL |
11-
| [bashman_core](https://github.com/Blobfolio/bashman) | 0.3.7 | [Josh Stoik](mailto:[email protected]) | WTFPL |
12-
| [camino](https://github.com/camino-rs/camino) | 1.0.8 | [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 |
11+
| [bashman_core](https://github.com/Blobfolio/bashman) | 0.3.8 | [Josh Stoik](mailto:[email protected]) | WTFPL |
12+
| [camino](https://github.com/camino-rs/camino) | 1.0.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 |
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.14.2 | [Oliver Schneider](mailto:[email protected]) | MIT |
1515
| [dactyl](https://github.com/Blobfolio/dactyl) | 0.3.4 | [Blobfolio, LLC.](mailto:[email protected]) | WTFPL |

bashman/Cargo.toml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "cargo-bashman"
3-
version = "0.3.7"
3+
version = "0.3.8"
44
license = "WTFPL"
55
authors = ["Josh Stoik <[email protected]>"]
66
edition = "2021"
@@ -51,6 +51,13 @@ short = "-V"
5151
long = "--version"
5252
description = "Print application version."
5353

54+
[[package.metadata.bashman.options]]
55+
short = "-f"
56+
long = "--features"
57+
description = "Comma-separated list of optional features to include when generating CREDITS.md."
58+
label = "<Cargo.toml>"
59+
path = false
60+
5461
[[package.metadata.bashman.options]]
5562
short = "-m"
5663
long = "--manifest-path"

bashman/src/main.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ use bashman_core::{
4646
FLAG_MAN,
4747
};
4848
use fyi_msg::Msg;
49-
use std::path::PathBuf;
49+
use std::{
50+
ffi::OsStr,
51+
path::PathBuf,
52+
};
5053

5154

5255

@@ -57,12 +60,8 @@ fn main() {
5760
Err(BashManError::Argue(ArgyleError::WantsVersion)) => {
5861
println!(concat!("Cargo BashMan v", env!("CARGO_PKG_VERSION")));
5962
},
60-
Err(BashManError::Argue(ArgyleError::WantsHelp)) => {
61-
helper();
62-
},
63-
Err(e) => {
64-
Msg::error(e.to_string()).die(1);
65-
},
63+
Err(BashManError::Argue(ArgyleError::WantsHelp)) => { helper(); },
64+
Err(e) => { Msg::error(e.to_string()).die(1); },
6665
}
6766
}
6867

@@ -83,6 +82,8 @@ fn _main() -> Result<(), BashManError> {
8382
flags &= ! FLAG_MAN;
8483
}
8584

85+
let features = args.option2_os(b"-f", b"--features").and_then(OsStr::to_str);
86+
8687
let manifest =
8788
if let Some(p) = args.option2_os(b"-m", b"--manifest-path") {
8889
PathBuf::from(p)
@@ -93,7 +94,7 @@ fn _main() -> Result<(), BashManError> {
9394
.join("Cargo.toml")
9495
};
9596

96-
bashman_core::parse(manifest, flags)?;
97+
bashman_core::parse(manifest, flags, features)?;
9798

9899
Ok(())
99100
}
@@ -129,6 +130,8 @@ FLAGS:
129130
-V, --version Prints version information.
130131
131132
OPTIONS:
133+
-f, --features <FEATURES> Comma-separated list of optional features to
134+
include when generating CREDITS.md.
132135
-m, --manifest-path <FILE> Read file paths from this list.
133136
"
134137
));

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

bashman_core/src/credits.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ narrower than theirs.
77

88
use adbyss_psl::Domain;
99
use cargo_metadata::{
10+
CargoOpt,
1011
DependencyKind,
1112
DepKindInfo,
1213
MetadataCommand,
@@ -75,10 +76,25 @@ impl PartialOrd for Dependency {
7576

7677

7778
/// # Get Dependencies.
78-
pub(super) fn get_dependencies(src: &Path) -> Result<Vec<Dependency>, BashManError> {
79+
pub(super) fn get_dependencies(src: &Path, features: Option<&str>) -> Result<Vec<Dependency>, BashManError> {
7980
let metadata = {
8081
let mut cmd = MetadataCommand::new();
8182
cmd.manifest_path(&src);
83+
84+
// Enable extra features?
85+
if let Some(features) = features {
86+
let features: Vec<String> = features.split(',')
87+
.filter_map(|f| {
88+
let f = f.trim();
89+
if f.is_empty() { None }
90+
else { Some(f.to_owned()) }
91+
})
92+
.collect();
93+
if ! features.is_empty() {
94+
cmd.features(CargoOpt::SomeFeatures(features));
95+
}
96+
}
97+
8298
cmd.exec().map_err(|_| BashManError::InvalidManifest)?
8399
};
84100

bashman_core/src/data.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -525,9 +525,15 @@ impl<'a> Command<'a> {
525525
/// # Credits.
526526
impl<'a> Command<'a> {
527527
/// # Write Bash.
528-
pub(crate) fn write_credits(&self, manifest: &Path, dir: &Path, buf: &mut Vec<u8>) -> Result<(), BashManError> {
528+
pub(crate) fn write_credits(
529+
&self,
530+
manifest: &Path,
531+
features: Option<&str>,
532+
dir: &Path,
533+
buf: &mut Vec<u8>,
534+
) -> Result<(), BashManError> {
529535
// Get the dependencies.
530-
let raw = crate::credits::get_dependencies(manifest)?;
536+
let raw = crate::credits::get_dependencies(manifest, features)?;
531537

532538
// Write the header.
533539
buf.extend_from_slice(format!(

bashman_core/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ pub const FLAG_ALL: u8 = 0b0111;
7070
///
7171
/// Returns an error if the BASH/Man output paths are invalid, or any other
7272
/// metadata parsing issues come up.
73-
pub fn parse(manifest: PathBuf, flags: u8) -> Result<(), BashManError> {
73+
pub fn parse(manifest: PathBuf, flags: u8, features: Option<&str>) -> Result<(), BashManError> {
7474
// Clean up the manifest path.
7575
let manifest = std::fs::canonicalize(manifest)
7676
.map_err(|_| BashManError::InvalidManifest)?;
@@ -109,6 +109,7 @@ pub fn parse(manifest: PathBuf, flags: u8) -> Result<(), BashManError> {
109109
if FLAG_CREDITS == flags & FLAG_CREDITS {
110110
cmd.write_credits(
111111
&manifest,
112+
features,
112113
&raw.credits_dir(&dir)?,
113114
&mut buf
114115
)?;

release/completions/cargo-bashman.bash

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ _basher___cargo_bashman() {
1515
opts+=("-V")
1616
opts+=("--version")
1717
fi
18+
if [[ ! " ${COMP_LINE} " =~ " -f " ]] && [[ ! " ${COMP_LINE} " =~ " --features " ]]; then
19+
opts+=("-f")
20+
opts+=("--features")
21+
fi
1822
if [[ ! " ${COMP_LINE} " =~ " -m " ]] && [[ ! " ${COMP_LINE} " =~ " --manifest-path " ]]; then
1923
opts+=("-m")
2024
opts+=("--manifest-path")

release/man/cargo-bashman.1

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
.TH "CARGO BASHMAN" "1" "May 2022" "Cargo BashMan v0.3.7" "User Commands"
1+
.TH "CARGO BASHMAN" "1" "May 2022" "Cargo BashMan v0.3.8" "User Commands"
22
.SH NAME
3-
Cargo BashMan \- Manual page for cargo\-bashman v0.3.7.
3+
Cargo BashMan \- Manual page for cargo\-bashman v0.3.8.
44
.SH DESCRIPTION
55
A Cargo plugin to generate BASH completions and MAN pages.
66
.SS USAGE:
@@ -24,5 +24,8 @@ Do not generate MAN page(s).
2424
Print application version.
2525
.SS OPTIONS:
2626
.TP
27+
\fB\-f\fR, \fB\-\-features\fR <Cargo.toml>
28+
Comma\-separated list of optional features to include when generating CREDITS.md.
29+
.TP
2730
\fB\-m\fR, \fB\-\-manifest\-path\fR <Cargo.toml>
2831
Path to the Cargo.toml file to use.

0 commit comments

Comments
 (0)