mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-13 17:13:48 +00:00
Use Arguments::from_os
This commit is contained in:
parent
57140f1730
commit
0353e1c6f4
@ -40,16 +40,10 @@ impl Verbosity {
|
|||||||
fn main() -> Result<()> {
|
fn main() -> Result<()> {
|
||||||
env_logger::try_init()?;
|
env_logger::try_init()?;
|
||||||
|
|
||||||
let subcommand = match std::env::args_os().nth(1) {
|
let mut matches = Arguments::from_env();
|
||||||
None => {
|
let subcommand = matches.subcommand()?.unwrap_or_default();
|
||||||
eprintln!("{}", help::GLOBAL_HELP);
|
|
||||||
return Ok(());
|
|
||||||
}
|
|
||||||
Some(s) => s,
|
|
||||||
};
|
|
||||||
let mut matches = Arguments::from_vec(std::env::args_os().skip(2).collect());
|
|
||||||
|
|
||||||
match &*subcommand.to_string_lossy() {
|
match subcommand.as_str() {
|
||||||
"parse" => {
|
"parse" => {
|
||||||
if matches.contains(["-h", "--help"]) {
|
if matches.contains(["-h", "--help"]) {
|
||||||
eprintln!("{}", help::PARSE_HELP);
|
eprintln!("{}", help::PARSE_HELP);
|
||||||
|
Loading…
Reference in New Issue
Block a user