use crate::errors::*;
use std::io::stdout;
use structopt::clap::{AppSettings, Shell};
use structopt::StructOpt;
#[derive(Debug, StructOpt)]
#[structopt(about="Smash staged changes into previous commits.", global_settings = &[AppSettings::ColoredHelp, AppSettings::DeriveDisplayOrder])]
pub struct Args {
#[structopt(long, group = "mode")]
pub list: bool,
#[structopt(long, group = "mode")]
pub select: bool,
#[structopt(long)]
pub format: Option<String>,
#[structopt(long, short = "n")]
pub max_count: Option<u32>,
#[structopt(long, short = "a", group = "rev_range")]
pub all: bool,
#[structopt(long, short = "l", group = "rev_range")]
pub local: bool,
#[structopt(long, group = "autorebase")]
pub rebase: bool,
#[structopt(long, group = "autorebase")]
pub no_rebase: bool,
#[structopt(long, short = "i")]
pub interactive: bool,
#[structopt(long, group = "list_blame")]
pub blame: bool,
#[structopt(long, group = "list_blame")]
pub no_blame: bool,
#[structopt(long, group = "list_files")]
pub files: bool,
#[structopt(long, group = "list_files")]
pub no_files: bool,
#[structopt(long)]
pub recent: Option<u32>,
#[structopt(long, group = "rev_range", name = "revision-range")]
pub range: Option<String>,
#[structopt(long, group = "fixup_mode")]
pub amend: bool,
#[structopt(long, group = "fixup_mode")]
pub reword: bool,
#[structopt()]
pub commit: Option<String>,
#[structopt(subcommand)]
pub subcommand: Option<SubCommand>,
}
#[derive(Debug, StructOpt)]
pub enum SubCommand {
#[structopt(name = "completions")]
Completions(Completions),
}
#[derive(Debug, StructOpt)]
pub struct Completions {
#[structopt(possible_values=&Shell::variants())]
pub shell: Shell,
}
pub fn gen_completions(args: &Completions) -> Result<()> {
Args::clap().gen_completions_to("git-smash", args.shell, &mut stdout());
Ok(())
}