xref: /DragonOS/user/apps/test_ebpf/syscall_ebpf/xtask/src/main.rs (revision fae6e9ade46a52976ad5d099643d51cc20876448)
1 mod build_ebpf;
2 mod build;
3 mod run;
4 
5 use std::process::exit;
6 
7 use clap::Parser;
8 
9 #[derive(Debug, Parser)]
10 pub struct Options {
11     #[clap(subcommand)]
12     command: Command,
13 }
14 
15 #[derive(Debug, Parser)]
16 enum Command {
17     BuildEbpf(build_ebpf::Options),
18     Build(build::Options),
19     Run(run::Options),
20 }
21 
main()22 fn main() {
23     let opts = Options::parse();
24 
25     use Command::*;
26     let ret = match opts.command {
27         BuildEbpf(opts) => build_ebpf::build_ebpf(opts),
28         Run(opts) => run::run(opts),
29         Build(opts) => build::build(opts),
30     };
31 
32     if let Err(e) = ret {
33         eprintln!("{e:#}");
34         exit(1);
35     }
36 }
37