1mod analyze;
2mod check;
3mod verify;
4pub use analyze::*;
5pub use check::*;
6use clap::{Args, Subcommand};
7pub use verify::*;
8
9#[derive(Args, Debug, Clone)]
10pub struct RapxArgs {
11 #[command(subcommand)]
12 pub command: Commands,
13 #[arg(long, help = "specify the timeout seconds in running rapx")]
14 pub timeout: Option<u64>,
15 #[arg(long, help = "specify the tested package in the workspace")]
16 pub test_crate: Option<String>,
17}
18
19#[derive(Debug, Clone, Subcommand)]
22pub enum Commands {
23 #[command(arg_required_else_help = true)]
25 Analyze {
26 #[command(subcommand)]
27 kind: AnalysisKind,
28 },
29 Check(CheckArgs),
32 Opt,
34 Verify(VerifyArgs),
36}
37
38impl RapxArgs {
39 pub fn init_env(&self) {
40 let Commands::Check(CheckArgs {
41 uaf: Some(level), ..
42 }) = &self.command
43 else {
44 return;
45 };
46 unsafe {
47 std::env::set_var("MOP", level.to_string());
48 }
49 }
50}