1mod analyze;
2mod check;
3mod verify;
4pub use analyze::*;
5pub use check::*;
6use clap::{Args, Subcommand, ValueEnum};
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 Verify(VerifyArgs),
34}
35
36#[derive(Debug, Clone, Copy, ValueEnum)]
37pub enum OptLevel {
38 Report,
39 Default,
40 All,
41}
42
43impl RapxArgs {
44 pub fn init_env(&self) {
45 let Commands::Check(CheckArgs {
46 uaf: Some(level), ..
47 }) = &self.command
48 else {
49 return;
50 };
51 unsafe {
52 std::env::set_var("MOP", level.to_string());
53 }
54 }
55}