chore: update clap
This commit is contained in:
@@ -1,30 +1,30 @@
|
||||
use clap::{App, Arg, SubCommand, ArgMatches};
|
||||
use clap::{Arg, Command, ArgMatches};
|
||||
|
||||
use crate::global;
|
||||
use crate::commands;
|
||||
use crate::commands::status::StatusArgs;
|
||||
|
||||
pub fn create() -> App<'static, 'static> {
|
||||
SubCommand::with_name("status")
|
||||
pub fn create() -> Command {
|
||||
Command::new("status")
|
||||
.arg(
|
||||
Arg::with_name("directory")
|
||||
.required(false)
|
||||
.takes_value(true)
|
||||
Arg::new("directory")
|
||||
.num_args(1)
|
||||
.value_name("DIRECTORY")
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("nostyle")
|
||||
Arg::new("nostyle")
|
||||
.long("nostyle")
|
||||
.help("Status with minium information and style"),
|
||||
)
|
||||
.about("Show the working tree status")
|
||||
}
|
||||
|
||||
pub fn handler(args: &ArgMatches<'_>) {
|
||||
if let Some(val) = args.values_of("directory") {
|
||||
global::global::set_dir_path(String::from(val.clone().next().unwrap()));
|
||||
pub fn handler(args: &ArgMatches) {
|
||||
if let Some(val) = args.get_one::<String>("directory") {
|
||||
global::global::set_dir_path(val.to_string());
|
||||
}
|
||||
|
||||
commands::status::status(StatusArgs {
|
||||
nostyle: args.is_present("nostyle"),
|
||||
nostyle: args.contains_id("nostyle"),
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user