Use Arguments::from_os

This commit is contained in:
Aleksey Kladov 2020-02-17 17:12:37 +01:00
parent 57140f1730
commit 0353e1c6f4

View File

@ -40,16 +40,10 @@ impl Verbosity {
fn main() -> Result<()> {
env_logger::try_init()?;
let subcommand = match std::env::args_os().nth(1) {
None => {
eprintln!("{}", help::GLOBAL_HELP);
return Ok(());
}
Some(s) => s,
};
let mut matches = Arguments::from_vec(std::env::args_os().skip(2).collect());
let mut matches = Arguments::from_env();
let subcommand = matches.subcommand()?.unwrap_or_default();
match &*subcommand.to_string_lossy() {
match subcommand.as_str() {
"parse" => {
if matches.contains(["-h", "--help"]) {
eprintln!("{}", help::PARSE_HELP);