diff options
author | Jesse Luehrs <doy@tozt.net> | 2023-03-26 00:28:29 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2023-03-26 00:28:29 -0400 |
commit | 688bc5177951ce01d22395a1aa8ed7d43d23d73e (patch) | |
tree | 9cb40d5a5d60a8c8d4be1fe091c2cab6fc3a35f8 /src/args.rs | |
parent | 6f19f96053db7475e2376c9dd3179c4dd2264df8 (diff) | |
download | fancy-prompt-688bc5177951ce01d22395a1aa8ed7d43d23d73e.tar.gz fancy-prompt-688bc5177951ce01d22395a1aa8ed7d43d23d73e.zip |
bump deps
Diffstat (limited to 'src/args.rs')
-rw-r--r-- | src/args.rs | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/src/args.rs b/src/args.rs index da1ff19..f0c65d0 100644 --- a/src/args.rs +++ b/src/args.rs @@ -6,32 +6,31 @@ pub struct CommandLineOptions { } pub fn parse() -> CommandLineOptions { - let matches = clap::App::new("fancy-prompt") + let matches = clap::Command::new("fancy-prompt") .about("Prints a fancy prompt") - .author(crate_authors!()) - .version(crate_version!()) + .author(clap::crate_authors!()) + .version(clap::crate_version!()) .arg( - clap::Arg::with_name("prompt-escape") + clap::Arg::new("prompt-escape") .long("prompt-escape") .value_name("SHELL") - .help("Produces escape sequence wrappers for the given shell") - .takes_value(true), + .help( + "Produces escape sequence wrappers for the given shell", + ), ) .arg( - clap::Arg::with_name("error-code") + clap::Arg::new("error-code") .value_name("ERROR_CODE") .help("The error code of the previously run command"), ) .get_matches(); let shell = matches - .value_of("prompt-escape") - .map(colors::ShellType::from_str) + .get_one::<String>("prompt-escape") + .map(|s| colors::ShellType::from_str(&s)) .unwrap_or(colors::ShellType::Unknown); - let error_code = matches - .value_of("error-code") - .map(|code| code.parse().expect("error code must be a u8")) - .unwrap_or(0); + let error_code = + matches.get_one::<u8>("error-code").copied().unwrap_or(0); CommandLineOptions { shell, error_code } } |