2019-05-24 10:25:55 +02:00
|
|
|
use crate::common::*;
|
|
|
|
|
2020-01-16 08:37:12 +01:00
|
|
|
use structopt::clap::{AppSettings, ArgSettings};
|
2020-01-14 09:52:27 +01:00
|
|
|
|
2019-05-24 10:25:55 +02:00
|
|
|
#[derive(StructOpt)]
|
2020-01-14 09:52:27 +01:00
|
|
|
#[structopt(
|
|
|
|
about(consts::ABOUT),
|
|
|
|
version(consts::VERSION),
|
|
|
|
author(consts::AUTHOR),
|
2020-01-16 08:37:12 +01:00
|
|
|
global_setting(AppSettings::ColoredHelp),
|
|
|
|
global_setting(AppSettings::ColorAuto)
|
2020-01-14 09:52:27 +01:00
|
|
|
)]
|
2019-05-24 10:25:55 +02:00
|
|
|
pub(crate) struct Opt {
|
|
|
|
#[structopt(long = "unstable", short = "u")]
|
|
|
|
unstable: bool,
|
2020-01-16 08:37:12 +01:00
|
|
|
#[structopt(
|
|
|
|
long = "color",
|
|
|
|
default_value = use_color::AUTO,
|
|
|
|
set = ArgSettings::CaseInsensitive,
|
|
|
|
possible_values = use_color::VALUES,
|
|
|
|
)]
|
|
|
|
pub(crate) use_color: UseColor,
|
2019-05-24 10:25:55 +02:00
|
|
|
#[structopt(subcommand)]
|
|
|
|
subcommand: Subcommand,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Opt {
|
2020-01-08 03:05:48 +01:00
|
|
|
pub(crate) fn run(self, env: &mut Env) -> Result<(), Error> {
|
2019-05-24 10:25:55 +02:00
|
|
|
self.subcommand.run(env, self.unstable)
|
|
|
|
}
|
|
|
|
}
|