mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-12-25 03:04:13 +03:00
removed accidental default implementations
This commit is contained in:
parent
941cf1e8c7
commit
c6abb26ffe
@ -139,91 +139,4 @@ impl CLI for LoginCommand {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn new<'a, 'b>() -> clap::App<'a, 'b> {
|
||||
let arguments = &Self::ARGUMENTS
|
||||
.iter()
|
||||
.map(|a| {
|
||||
let mut args = clap::Arg::with_name(a.0).help(a.1).required(a.3).index(a.4);
|
||||
if !a.2.is_empty() {
|
||||
args = args.possible_values(a.2);
|
||||
}
|
||||
args
|
||||
})
|
||||
.collect::<Vec<clap::Arg<'static, 'static>>>();
|
||||
let flags = &Self::FLAGS
|
||||
.iter()
|
||||
.map(|a| clap::Arg::from_usage(a))
|
||||
.collect::<Vec<clap::Arg<'static, 'static>>>();
|
||||
let options = &Self::OPTIONS
|
||||
.iter()
|
||||
.map(|a| match !a.2.is_empty() {
|
||||
true => clap::Arg::from_usage(a.0)
|
||||
.conflicts_with_all(a.1)
|
||||
.possible_values(a.2)
|
||||
.requires_all(a.3),
|
||||
false => clap::Arg::from_usage(a.0).conflicts_with_all(a.1).requires_all(a.3),
|
||||
})
|
||||
.collect::<Vec<clap::Arg<'static, 'static>>>();
|
||||
let subcommands = Self::SUBCOMMANDS.iter().map(|s| {
|
||||
clap::SubCommand::with_name(s.0)
|
||||
.about(s.1)
|
||||
.args(
|
||||
&s.2.iter()
|
||||
.map(|a| {
|
||||
let mut args = clap::Arg::with_name(a.0).help(a.1).required(a.3).index(a.4);
|
||||
if !a.2.is_empty() {
|
||||
args = args.possible_values(a.2);
|
||||
}
|
||||
args
|
||||
})
|
||||
.collect::<Vec<clap::Arg<'static, 'static>>>(),
|
||||
)
|
||||
.args(
|
||||
&s.3.iter()
|
||||
.map(|a| clap::Arg::from_usage(a))
|
||||
.collect::<Vec<clap::Arg<'static, 'static>>>(),
|
||||
)
|
||||
.args(
|
||||
&s.4.iter()
|
||||
.map(|a| match !a.2.is_empty() {
|
||||
true => clap::Arg::from_usage(a.0)
|
||||
.conflicts_with_all(a.1)
|
||||
.possible_values(a.2)
|
||||
.requires_all(a.3),
|
||||
false => clap::Arg::from_usage(a.0).conflicts_with_all(a.1).requires_all(a.3),
|
||||
})
|
||||
.collect::<Vec<clap::Arg<'static, 'static>>>(),
|
||||
)
|
||||
.settings(s.5)
|
||||
});
|
||||
|
||||
clap::SubCommand::with_name(Self::NAME)
|
||||
.about(Self::ABOUT)
|
||||
.settings(&[
|
||||
clap::AppSettings::ColoredHelp,
|
||||
clap::AppSettings::DisableHelpSubcommand,
|
||||
clap::AppSettings::DisableVersion,
|
||||
])
|
||||
.args(arguments)
|
||||
.args(flags)
|
||||
.args(options)
|
||||
.subcommands(subcommands)
|
||||
}
|
||||
|
||||
fn process(arguments: &clap::ArgMatches) -> Result<(), CLIError> {
|
||||
// Set logging environment
|
||||
match arguments.is_present("debug") {
|
||||
true => crate::logger::init_logger("leo", 2),
|
||||
false => crate::logger::init_logger("leo", 1),
|
||||
}
|
||||
|
||||
if arguments.subcommand().0 != "update" {
|
||||
crate::updater::Updater::print_cli();
|
||||
}
|
||||
|
||||
let options = Self::parse(arguments)?;
|
||||
let _output = Self::output(options)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user