Skip to content

Commit 61cc59b

Browse files
authored
Merge pull request #111 from jhscheer/add_requires_to_report_flags
add clap requires to flags that depent on --report
2 parents b473dce + 6279666 commit 61cc59b

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/render/context/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,11 @@ pub struct Context {
8686
pub report: bool,
8787

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

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

9696
/// Sort-order to display directory content

tests/report.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,15 @@ fn report_with_level() {
7373
)
7474
)
7575
}
76+
77+
#[test]
78+
#[should_panic]
79+
fn report_requires_human() {
80+
utils::run_cmd(&["--human"]);
81+
}
82+
83+
#[test]
84+
#[should_panic]
85+
fn report_requires_file_name() {
86+
utils::run_cmd(&["--file-name"]);
87+
}

0 commit comments

Comments
 (0)