我想创建一个利用 clap 来解析输入的命令行。我能想到的最好的办法是一个循环,要求用户输入,用正则表达式将其分解并构建一个 Vec,并以某种方式传递给它
loop {
    // Print command prompt and get command
    print!("> "); io::stdout().flush().expect("Couldn't flush stdout");
    let mut input = String::new(); // Take user input (to be parsed as clap args)
    io::stdin().read_line(&mut input).expect("Error reading input.");
    let args = WORD.captures_iter(&input)
           .map(|cap| cap.get(1).or(cap.get(2)).unwrap().as_str())
           .collect::<Vec<&str>>();
    let matches = App::new("MyApp")
        // ... Process Clap args/subcommands
    .get_matches(args); //match arguments from CLI args variable
}
基本上,我想知道是否有一种方法可以指示 Clap 使用预先给定的参数列表?