update aya-gen from structopt to clap 3

pull/297/head
Davide Bertola 3 years ago
parent ddf26300c8
commit ad93b7da7f

@ -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"

@ -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<String>,
},
@ -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)?;

Loading…
Cancel
Save