diff --git a/aya-gen/Cargo.toml b/aya-gen/Cargo.toml index 3a0cea6d..dc38497f 100644 --- a/aya-gen/Cargo.toml +++ b/aya-gen/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" [dependencies] bindgen = "0.60" -structopt = {version = "0.3", default-features = false } +clap = { version = "3", features = ["derive"] } anyhow = "1" thiserror = "1" syn = "1" diff --git a/aya-gen/src/bin/aya-gen.rs b/aya-gen/src/bin/aya-gen.rs index 7530df3e..71867dbf 100644 --- a/aya-gen/src/bin/aya-gen.rs +++ b/aya-gen/src/bin/aya-gen.rs @@ -2,18 +2,19 @@ use aya_gen::btf_types; use std::{path::PathBuf, process::exit}; -use structopt::StructOpt; -#[derive(StructOpt)] +use clap::Parser; + +#[derive(Parser)] pub struct Options { - #[structopt(subcommand)] + #[clap(subcommand)] command: Command, } -#[derive(StructOpt)] +#[derive(Parser)] enum Command { - #[structopt(name = "btf-types")] + #[clap(name = "btf-types")] BtfTypes { - #[structopt(long, default_value = "/sys/kernel/btf/vmlinux")] + #[clap(long, default_value = "/sys/kernel/btf/vmlinux")] btf: PathBuf, names: Vec, }, @@ -27,7 +28,7 @@ fn main() { } fn try_main() -> Result<(), anyhow::Error> { - let opts = Options::from_args(); + let opts = Options::parse(); match opts.command { Command::BtfTypes { btf, names } => { let bindings = btf_types::generate(&btf, &names)?;