Skip to content

Commit

Permalink
Merge pull request #111 from jhscheer/add_requires_to_report_flags
Browse files Browse the repository at this point in the history
add clap requires to flags that depent on --report
  • Loading branch information
solidiquis authored Apr 2, 2023
2 parents b473dce + 6279666 commit 61cc59b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/render/context/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ pub struct Context {
pub report: bool,

/// Print human-readable disk usage in report
#[arg(long)]
#[arg(long, requires = "report")]
pub human: bool,

/// Print file-name in report as opposed to full path
#[arg(long)]
#[arg(long, requires = "report")]
pub file_name: bool,

/// Sort-order to display directory content
Expand Down
12 changes: 12 additions & 0 deletions tests/report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,15 @@ fn report_with_level() {
)
)
}

#[test]
#[should_panic]
fn report_requires_human() {
utils::run_cmd(&["--human"]);
}

#[test]
#[should_panic]
fn report_requires_file_name() {
utils::run_cmd(&["--file-name"]);
}

0 comments on commit 61cc59b

Please sign in to comment.