mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-12 16:45:37 +00:00
Use Arguments::from_os
This commit is contained in:
parent
57140f1730
commit
0353e1c6f4
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user