Skip to content

Commit

Permalink
cmdline: support hex numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
bradjc committed Sep 9, 2023
1 parent 1972a93 commit 8f13f77
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
10 changes: 10 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ path = "src/main.rs"
[dependencies]
chrono = { version = "0.4.26", default-features = false, features = ["clock", "std"] }
clap = { version = "4.3.17", features = ["derive", "color", "wrap_help"] }
clap-num = "1.0.2"
tar = "0.4.39"
elf = "0.7.2"
sha2 = "0.10.7"
Expand Down
5 changes: 4 additions & 1 deletion src/cmdline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ pub struct Opt {
#[arg(
long = "write_id",
id = "write_id",
help = "A storage ID used for writing data"
help = "A storage ID used for writing data",
value_parser=clap_num::maybe_hex::<u32>,
)]
pub write_id: Option<u32>,

Expand All @@ -143,6 +144,7 @@ pub struct Opt {
id = "read_ids",
help = "Storage IDs that this app is allowed to read",
num_args = 1..,
value_parser=clap_num::maybe_hex::<u32>,
)]
pub read_ids: Option<Vec<u32>>,

Expand All @@ -151,6 +153,7 @@ pub struct Opt {
id = "access_ids",
help = "Storage IDs that this app is allowed to write",
num_args = 1..,
value_parser=clap_num::maybe_hex::<u32>,
)]
pub access_ids: Option<Vec<u32>>,

Expand Down

0 comments on commit 8f13f77

Please sign in to comment.