-2

我懂了:

let args: Vec::<String> = std::env::args().collect();
let matches = App::new("Rust grader")
                    .author("Arkadiusz Bulski <arek.bulski@gmail.com>")
                    .arg(Arg::with_name("noprofile")
                            .long("noprofile")
                            .takes_value(false)
                            .help("Disable profiling, save time"))
                    .get_matches();
let config = matches.value_of("noprofile");

还有一个用法: ./binary-runner --noprofile -- tsp-arekbulski-*.rs

我怎样才能让这个拍手应用程序识别文件名?

错误:

error: Found argument 'tsp-arekbulski-01-trivial.rs' which wasn't expected, or isn't valid in this context

USAGE:
    binary-runner --noprofile
4

1 回答 1

0

解决了它:

let matches = App::new("Rust runner")
                    .author("Arkadiusz Bulski <arek.bulski@gmail.com>")
                    .arg(Arg::with_name("sources")
                            .multiple(true)
                            .help("Use this to pass argfilenames"))
                    .get_matches();
于 2021-04-28T11:35:26.900 回答