我使用的是Clap,我的YAML文件有以下内容:
args:
- DIRECTORY
help: one or more directories
required: true
multiple: true在我的main.rs中,我希望获得作为参数传递的每个目录的名称,并执行如下操作
dir_names.push(name_of_the_directory);其中dir_names是向量,name_of_the_directory是字符串片。
我该怎么做?
发布于 2018-03-16 08:57:38
您可以通过使用values_of方法来做到这一点:
let dir_names: Vec<&str> = m.values_of("output").unwrap().collect();https://stackoverflow.com/questions/49314122
复制相似问题