diff --git a/aya-gen/src/bin/aya-gen.rs b/aya-gen/src/bin/aya-gen.rs index 8f976aa0..5706f602 100644 --- a/aya-gen/src/bin/aya-gen.rs +++ b/aya-gen/src/bin/aya-gen.rs @@ -12,14 +12,15 @@ pub struct Options { #[derive(Parser)] enum Command { - #[clap(name = "generate")] + #[clap(name = "generate", action)] Generate { - #[clap(long, default_value = "/sys/kernel/btf/vmlinux")] + #[clap(long, default_value = "/sys/kernel/btf/vmlinux", action)] btf: PathBuf, - #[clap(long, conflicts_with = "btf")] + #[clap(long, conflicts_with = "btf", action)] header: Option, + #[clap(action)] names: Vec, - #[clap(last = true)] + #[clap(last = true, action)] bindgen_args: Vec, }, } @@ -40,12 +41,11 @@ fn try_main() -> Result<(), anyhow::Error> { names, bindgen_args, } => { - let bindings: String; - if let Some(header) = header { - bindings = generate(InputFile::Header(header), &names, &bindgen_args)?; + let bindings: String = if let Some(header) = header { + generate(InputFile::Header(header), &names, &bindgen_args)? } else { - bindings = generate(InputFile::Btf(btf), &names, &bindgen_args)?; - } + generate(InputFile::Btf(btf), &names, &bindgen_args)? + }; println!("{}", bindings); } };