diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml index 9945567a..a40372c5 100644 --- a/xtask/Cargo.toml +++ b/xtask/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" [dependencies] aya-gen = { path = "../aya-gen" } -structopt = {version = "0.3", default-features = false } +clap = { version = "3", features = ["derive"] } anyhow = "1" syn = "1" quote = "1" diff --git a/xtask/src/codegen/mod.rs b/xtask/src/codegen/mod.rs index d5b56105..a088e0bd 100644 --- a/xtask/src/codegen/mod.rs +++ b/xtask/src/codegen/mod.rs @@ -4,7 +4,7 @@ mod helpers; use std::path::PathBuf; -use structopt::StructOpt; +use clap::Parser; const SUPPORTED_ARCHS: &[Architecture] = &[ Architecture::X86_64, @@ -52,34 +52,34 @@ impl std::fmt::Display for Architecture { } } -#[derive(StructOpt)] +#[derive(Parser)] pub struct Options { - #[structopt(long)] + #[clap(long)] libbpf_dir: PathBuf, // sysroot options. Default to ubuntu headers installed by the // libc6-dev-{arm64,armel}-cross packages. - #[structopt(long, default_value = "/usr/include/x86_64-linux-gnu")] + #[clap(long, default_value = "/usr/include/x86_64-linux-gnu")] x86_64_sysroot: PathBuf, - #[structopt(long, default_value = "/usr/aarch64-linux-gnu/include")] + #[clap(long, default_value = "/usr/aarch64-linux-gnu/include")] aarch64_sysroot: PathBuf, - #[structopt(long, default_value = "/usr/arm-linux-gnueabi/include")] + #[clap(long, default_value = "/usr/arm-linux-gnueabi/include")] armv7_sysroot: PathBuf, - #[structopt(long, default_value = "/usr/riscv64-linux-gnu/include")] + #[clap(long, default_value = "/usr/riscv64-linux-gnu/include")] riscv64_sysroot: PathBuf, - #[structopt(subcommand)] + #[clap(subcommand)] command: Option, } -#[derive(StructOpt)] +#[derive(Parser)] enum Command { - #[structopt(name = "aya")] + #[clap(name = "aya")] Aya, - #[structopt(name = "aya-bpf-bindings")] + #[clap(name = "aya-bpf-bindings")] AyaBpfBindings, } diff --git a/xtask/src/main.rs b/xtask/src/main.rs index a11c16d3..406efd9f 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -3,21 +3,21 @@ mod docs; use std::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 { Codegen(codegen::Options), Docs, } fn main() { - let opts = Options::from_args(); + let opts = Options::parse(); use Command::*; let ret = match opts.command {