Skip to main content

eska_presentation/arguments/
check.rs

1//! Pure check option metadata shared by the optional shell and the standalone analysis owner.
2
3use crate::localization::Localizer;
4use clap::{Args, ValueEnum};
5use std::path::PathBuf;
6
7#[derive(Debug, Args)]
8pub struct CheckArgs {
9    #[arg(long)]
10    pub application: Option<String>,
11    #[arg(long)]
12    pub analyzer: Option<PathBuf>,
13    #[arg(long, default_value_t=600, value_parser=clap::value_parser!(u64).range(1..))]
14    pub timeout: u64,
15    #[arg(long, value_enum, default_value_t=Format::Human)]
16    pub format: Format,
17    #[arg(long)]
18    pub report: Option<PathBuf>,
19    #[arg(short, long, action=clap::ArgAction::Help)]
20    help: Option<bool>,
21}
22
23#[derive(Clone, Copy, Debug, ValueEnum)]
24pub enum Format {
25    Human,
26    Json,
27}
28
29/// Keep both entry points' analysis flags and descriptions identical without invoking a component.
30#[must_use]
31pub fn localize(mut command: clap::Command, localizer: &Localizer) -> clap::Command {
32    command = command.about(localizer.text("check-tool-about"));
33    for (name, key) in [
34        ("application", "project-application-help"),
35        ("analyzer", "analyzer-binary-help"),
36        ("timeout", "analyzer-timeout-help"),
37        ("format", "version-format-help"),
38        ("report", "check-report-help"),
39        ("help", "cli-help"),
40    ] {
41        command = command.mut_arg(name, |arg| arg.help(localizer.text(key)));
42    }
43    command
44}