use clap::{Args, Parser, Subcommand, ValueHint};
use clap_complete::Shell;
use std::path::PathBuf;
#[derive(Parser, Debug, PartialEq)]
#[command(author, version, about = "A security guard for your config files")]
#[command(arg_required_else_help = true)]
pub struct Cli {
#[arg(long = "base-dir", value_hint = ValueHint::DirPath)]
pub base_dir: Option<PathBuf>,
#[arg(short, long, action = clap::ArgAction::Count)]
pub debug: u8,
#[arg(long = "generate", value_enum)]
pub generator: Option<Shell>,
#[command(subcommand)]
pub command: Option<Commands>,
}
#[derive(Subcommand, Debug, PartialEq)]
pub enum Commands {
Info,
Show {
#[arg(value_hint = ValueHint::DirPath)]
source_dir: String,
},
Guard {
#[arg(value_hint = ValueHint::DirPath)]
source_dir: String,
#[arg(long = "absolute")]
absolute: bool,
},
Unguard {
#[arg(value_hint = ValueHint::DirPath)]
source_dir: String,
},
GuardOne {
#[arg(value_hint = ValueHint::DirPath)]
source_dir: String,
#[arg(value_hint = ValueHint::FilePath)]
source_path: String,
},
Relink {
#[arg(value_hint = ValueHint::FilePath)]
envrc_path: String,
},
ReplaceLink {
#[arg(value_hint = ValueHint::FilePath)]
link: String,
},
FixRunConfig {
#[arg(value_hint = ValueHint::DirPath)]
source_dir: String,
},
Init {
#[arg(value_hint = ValueHint::DirPath)]
source_dir: String,
#[arg(long = "template", value_hint = ValueHint::FilePath)]
template_path: Option<String>,
},
SopsEnc {
#[arg(long = "dir", value_hint = ValueHint::DirPath)]
dir: Option<String>,
},
SopsDec {
#[arg(long = "dir", value_hint = ValueHint::DirPath)]
dir: Option<String>,
},
SopsClean {
#[arg(long = "dir", value_hint = ValueHint::DirPath)]
dir: Option<String>,
},
SopsInit {
#[arg(long = "template", value_hint = ValueHint::FilePath)]
template_path: Option<String>,
},
}