Skip to content

Commit

Permalink
Provide a custom usage string for --help
Browse files Browse the repository at this point in the history
The generated output is not very readable. We can do better by providing
a custom string. This makes the binary smaller too.

[Drop indep]
  • Loading branch information
keszybz authored and nabijaczleweli committed Nov 27, 2024
1 parent 58a1ae6 commit a22ce97
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ exclude = ["tests/07a-mount-point-excl", "tests/10-example"]

[dependencies]
anyhow = "1.0.12"
clap = { version = "4.5", default-features = false, features = ["std", "cargo", "help", "usage", "error-context"] }
clap = { version = "4.5", default-features = false, features = ["std", "cargo", "help", "error-context"] }
liboverdrop = "0.1.0"
rust-ini = ">=0.15, <0.18"
log = { version = "0.4", features = ["std"] }
Expand Down
5 changes: 5 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ enum Opts {
#[rustfmt::skip]
fn command() -> clap::Command {
clap::command!()
.override_usage("\
\tzram-generator --setup-device <device>\n\
\tzram-generator --reset-device <device>\n\
\tzram-generator dir1 [dir2 dir3]\
")
.arg(
clap::arg!(--"setup-device" <device> "Set up a single device")
.conflicts_with("reset-device")
Expand Down

0 comments on commit a22ce97

Please sign in to comment.