use std::path::PathBuf;
use clap::{ArgGroup, Parser, builder::ArgAction};
use crate::types::{ColorOptions, PlatformType};
#[derive(Parser, Debug)]
#[command(
about = "A fast TLDR client",
version,
disable_version_flag = true,
author,
help_template = "{before-help}{name} {version}: {about-with-newline}{author-with-newline}
{usage-heading} {usage}
{all-args}{after-help}",
after_help = "To view the user documentation, please visit https://docs.tealdeer.org.
To view usage examples, run tldr tldr or tldr tealdeer.",
arg_required_else_help = true,
help_expected = true,
group = ArgGroup::new("command_or_file").args(&["command", "render"]),
)]
pub(crate) struct Cli {
#[arg(num_args(1..))]
pub command: Vec<String>,
#[arg(short = 'l', long = "list")]
pub list: bool,
#[arg(long, requires = "command")]
pub edit_page: bool,
#[arg(long, requires = "command", conflicts_with = "edit_page")]
pub edit_patch: bool,
#[arg(
short = 'f',
long = "render",
value_name = "FILE",
conflicts_with = "command"
)]
pub render: Option<PathBuf>,
#[arg(
short = 'p',
long = "platform",
value_name = "PLATFORM",
action = ArgAction::Append,
)]
pub platforms: Option<Vec<PlatformType>>,
#[arg(short = 'L', long = "language")]
pub language: Option<String>,
#[arg(short = 'u', long = "update")]
pub update: bool,
#[arg(long = "no-auto-update")]
pub no_auto_update: bool,
#[arg(short = 'c', long = "clear-cache")]
pub clear_cache: bool,
#[arg(long = "config-path", value_name = "FILE")]
pub config_path: Option<PathBuf>,
#[arg(long, action = ArgAction::Append, value_name = "OVERRIDE")]
pub override_config: Vec<String>,
#[arg(long = "pager", requires = "command_or_file")]
pub pager: bool,
#[arg(short = 'r', long = "raw", requires = "command_or_file")]
pub raw: bool,
#[arg(short = 'q', long = "quiet")]
pub quiet: bool,
#[arg(long = "show-paths")]
pub show_paths: bool,
#[arg(long = "seed-config")]
pub seed_config: bool,
#[arg(long = "color", value_name = "WHEN")]
pub color: Option<ColorOptions>,
#[arg(long)]
pub short_options: bool,
#[arg(long)]
pub long_options: bool,
#[arg(short = 'v', long = "version", action = ArgAction::Version)]
pub version: (),
}