Skip to content

Commit

Permalink
FIX: Require at least one file for dbn CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
threecgreen committed Dec 31, 2024
1 parent 24e0111 commit 6f712bc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions rust/dbn-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ pub struct Args {
value_name = "FILE...",
value_delimiter = ' ',
num_args = 1..,
required = true,
)]
pub input: Vec<PathBuf>,
#[clap(
Expand Down
14 changes: 12 additions & 2 deletions rust/dbn-cli/tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,16 @@ fn help() {
.arg("--help")
.assert()
.success()
.stdout(contains("Usage:"));
.stdout(contains("Usage:"))
.stderr(is_empty());
}

#[test]
fn empty() {
cmd().assert().failure().stdout(is_empty()).stderr(
contains("the following required arguments were not provided:\n <FILE...>")
.and(contains("Usage:")),
);
}

#[test]
Expand All @@ -799,5 +808,6 @@ fn version() {
.arg("--version")
.assert()
.success()
.stdout(contains(env!("CARGO_PKG_VERSION")));
.stdout(contains(env!("CARGO_PKG_VERSION")))
.stderr(is_empty());
}

0 comments on commit 6f712bc

Please sign in to comment.