fn match_cmdline()

in resctl-bench-intf/src/args.rs [373:495]


    fn match_cmdline() -> clap::ArgMatches<'static> {
        let job_file_arg = clap::Arg::with_name("file")
            .long("file")
            .short("f")
            .multiple(true)
            .takes_value(true)
            .number_of_values(1)
            .help("Benchmark job file");
        let job_spec_arg = clap::Arg::with_name("spec")
            .multiple(true)
            .help("Benchmark job spec - \"BENCH_TYPE[:KEY[=VAL][,KEY[=VAL]...]]...\"");

        let mut app = clap::App::new("resctl-bench")
            .version((*super::FULL_VERSION).as_str())
            .author(clap::crate_authors!("\n"))
            .about("Facebook Resource Control Benchmarks")
            .setting(clap::AppSettings::UnifiedHelpMessage)
            .setting(clap::AppSettings::DeriveDisplayOrder)
            .before_help(*HELP_BODY.lock().unwrap())
            .args_from_usage(&TOP_ARGS_STR)
            .subcommand(
                clap::SubCommand::with_name("run")
                    .about("Runs benchmarks")
                    .arg(job_file_arg.clone())
                    .arg(job_spec_arg.clone()),
            )
            .subcommand(
                clap::SubCommand::with_name("study")
                    .about("Studies benchmark results, all benchmarks must be complete")
                    .arg(clap::Arg::with_name("reports")
                         .long("reports")
                         .short("R")
                         .takes_value(true)
                         .help("Study reports in the directory (default: RESULTFILE_BASENAME-report.d/)"),
                    )
                    .arg(job_file_arg.clone())
                    .arg(job_spec_arg.clone()),
            )
            .subcommand(
                clap::SubCommand::with_name("solve")
                    .about("Solves benchmark results, optional phase to be used with merge")
                    .arg(job_file_arg.clone())
                    .arg(job_spec_arg.clone()),
            )
            .subcommand(
                clap::SubCommand::with_name("format")
                    .about("Formats benchmark results")
                    .arg(
                        clap::Arg::with_name("rstat")
                            .long("rstat")
                            .short("R")
                            .multiple(true)
                            .help(
                                "Report extra resource stats if available (repeat for even more)",
                            ),
                    )
                    .arg(job_file_arg.clone())
                    .arg(job_spec_arg.clone()),
            )
            .subcommand(
                clap::SubCommand::with_name("summary")
                    .about("Summarizes benchmark results")
                    .arg(job_file_arg.clone())
                    .arg(job_spec_arg.clone()),
            )
            .subcommand(clap::SubCommand::with_name("pack").about(
                "Create a tarball containing the result file and the associated report files",
            ))
            .subcommand(
                clap::SubCommand::with_name("merge")
                    .about("Merges result files from multiple runs on supported benchmarks")
                    .arg(
                        clap::Arg::with_name("SOURCEFILE")
                            .multiple(true)
                            .required(true)
                            .help("Result file to merge")
                    )
                    .arg(
                        clap::Arg::with_name("by-id")
                            .long("by-id")
                            .help("Don't ignore bench IDs when merging")
                    )
                    .arg(
                        clap::Arg::with_name("ignore-versions")
                            .long("ignore-versions")
                            .help("Ignore resctl-demo and bench versions when merging")
                    )
                    .arg(
                        clap::Arg::with_name("ignore-sysreqs")
                            .long("ignore-sysreqs")
                            .help("Accept results with missed sysreqs")
                    )
                    .arg(
                        clap::Arg::with_name("multiple")
                            .long("multiple")
                            .help("Allow more than one result per kind (and optionally id)")
                    )
            )
            .subcommand(
                clap::App::new("deps")
                    .about("Test all dependencies")
            )
            .subcommand(
                clap::App::new("doc")
                    .about("Shows documentations")
                    .arg(
                        clap::Arg::with_name("SUBJECT")
                            .multiple(true)
                            .required(true)
                            .help("Documentation subject to show")
                    )
                    .after_help(*DOC_AFTER_HELP.lock().unwrap())
                );

        if cfg!(feature = "lambda") {
            app = app.subcommand(
                clap::SubCommand::with_name("lambda")
                    .about("AWS lambda function that handles automated submission of results"),
            );
        }

        app.after_help(*AFTER_HELP.lock().unwrap()).get_matches()
    }