use clap::{App, AppSettings};
use minitt_util::cli::{cli_completion_generation, GenShellSubCommand};
use structopt::StructOpt;
#[derive(StructOpt)]
#[structopt(
about,
name = "minittc",
global_settings(&[AppSettings::ColoredHelp]),
)]
pub struct CliOptions {
#[structopt(short = "p", long)]
pub parse_only: bool,
#[structopt(short = "g", long)]
pub generated: bool,
#[structopt(short = "l", long)]
pub lexical_json: bool,
#[structopt(alias = "repl", short = "i", long)]
pub interactive: bool,
#[structopt(alias = "repl-plain", short = "j", long)]
pub interactive_plain: bool,
#[structopt(short = "q", long)]
pub quiet: bool,
#[structopt(name = "FILE")]
pub file: Option<String>,
#[structopt(subcommand)]
completion: Option<GenShellSubCommand>,
}
fn app<'a, 'b>() -> App<'a, 'b> {
let extra_help = "For extra help please head to \
https://github.com/owo-lang/minitt-rs/issues/new";
let app: App = CliOptions::clap();
app.after_help(extra_help)
}
pub fn pre() -> CliOptions {
let args: CliOptions = CliOptions::from_clap(&app().get_matches());
cli_completion_generation(&args.completion, app);
args
}