Skip to content

Commit

Permalink
Merge pull request containers#381 from lucab/ups/clap-v4
Browse files Browse the repository at this point in the history
cargo: bump to clap v4
  • Loading branch information
cgwalters authored May 18, 2023
2 parents 68e6805 + 04182ae commit 16a5b19
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ rust-version = "1.64.0"
[dependencies]
anyhow = "1.0"
ostree-ext = { path = "../lib" }
clap = "3.2"
clap = "4.2"
libc = "0.2.92"
tokio = { version = "1", features = ["macros"] }
log = "0.4.0"
Expand Down
4 changes: 2 additions & 2 deletions lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ bitflags = "1"
camino = "1.0.4"
chrono = "0.4.19"
olpc-cjson = "0.1.1"
clap = { version= "3.2", features = ["derive"] }
clap_mangen = { version = "0.1", optional = true }
clap = { version= "4.2", features = ["derive"] }
clap_mangen = { version = "0.2", optional = true }
cap-std-ext = "2.0"
cap-tempfile = "1.0"
flate2 = { features = ["zlib"], default_features = false, version = "1.0.20" }
Expand Down
3 changes: 1 addition & 2 deletions lib/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pub(crate) struct ExportOpts {
repo: Utf8PathBuf,

/// The format version. Must be 1.
#[clap(long, hidden(true))]
#[clap(long, hide(true))]
format_version: u32,

/// The ostree ref or commit to export
Expand Down Expand Up @@ -139,7 +139,6 @@ pub(crate) enum ContainerOpts {
compression_fast: bool,
},

#[clap(alias = "commit")]
/// Perform build-time checking and canonicalization.
/// This is presently an optional command, but may become required in the future.
Commit,
Expand Down
6 changes: 5 additions & 1 deletion lib/src/docgen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ fn generate_one(directory: &Utf8Path, cmd: Command) -> Result<()> {

for subcmd in cmd.get_subcommands().filter(|c| !c.is_hide_set()) {
let subname = format!("{}-{}", name, subcmd.get_name());
generate_one(directory, subcmd.clone().name(subname).version(version))?;
// SAFETY: Latest clap 4 requires names are &'static - this is
// not long-running production code, so we just leak the names here.
let subname = &*std::boxed::Box::leak(subname.into_boxed_str());
let subcmd = subcmd.clone().name(subname).alias(subname).version(version);
generate_one(directory, subcmd)?;
}
Ok(())
}

0 comments on commit 16a5b19

Please sign in to comment.