Skip to content

Commit

Permalink
rust: Rename BuildChunkedOCI struct to BuildChunkedOCIOpts
Browse files Browse the repository at this point in the history
For consistency, but also because it can be confusing to have the enum
variant be named the same as the underlying struct.

This caused a runtime issue for me that I can't reproduce anymore, but
for posterity:

```
$ rpm-ostree experimental compose build-chunked-oci
thread 'tokio-runtime-worker' panicked at /var/home/jlebon/.cargo/registry/src/index.crates.io-6f17d22bba15001f/clap_builder-4.5.27/src/builder/debug_asserts.rs:281:9:
Command build-chunked-oci: Argument group name must be unique

        'BuildChunkedOCI' is already in use
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: task 1 panicked with message "Command build-chunked-oci: Argument group name must be unique\n\n\t'BuildChunkedOCI' is already in use"
```
  • Loading branch information
jlebon committed Feb 5, 2025
1 parent 97ff196 commit 7ddb064
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion rust/src/cli_experimental.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ enum Cmd {
enum ComposeCmd {
BuildChunkedOCI {
#[clap(flatten)]
opts: crate::compose::BuildChunkedOCI,
opts: crate::compose::BuildChunkedOCIOpts,
},
}

Expand Down
4 changes: 2 additions & 2 deletions rust/src/compose.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ struct ComposeImageOpts {

/// Generate a "chunked" OCI archive from an input rootfs.
#[derive(Debug, Parser)]
pub(crate) struct BuildChunkedOCI {
pub(crate) struct BuildChunkedOCIOpts {
/// Path to the source root filesystem tree.
#[clap(long, required_unless_present = "from")]
rootfs: Option<Utf8PathBuf>,
Expand Down Expand Up @@ -269,7 +269,7 @@ impl Drop for PodmanMount {
}
}

impl BuildChunkedOCI {
impl BuildChunkedOCIOpts {
pub(crate) fn run(self) -> Result<()> {
enum FileSource {
Rootfs(Utf8PathBuf),
Expand Down

0 comments on commit 7ddb064

Please sign in to comment.