use clap::{Parser, Subcommand};
use std::path::PathBuf;
#[derive(Parser)]
#[command(name = "dotenvx")]
#[command(author, version, about = "A secure environment variable management tool with built-in encryption", long_about = None)]
pub struct Cli {
#[arg(short, long, global = true)]
pub verbose: bool,
#[arg(short, long, global = true)]
pub quiet: bool,
#[command(subcommand)]
pub command: Commands,
}
#[derive(Subcommand)]
pub enum Commands {
Keypair {
#[arg(short, long, default_value = "hex")]
format: String,
},
Encrypt {
#[arg(short = 'f', long = "env-file")]
env_files: Vec<PathBuf>,
#[arg(short = 'k', long = "env-keys-file")]
keys_file: Option<PathBuf>,
#[arg(short = 'K', long = "key")]
keys: Option<Vec<String>>,
#[arg(short = 'e', long = "exclude-key")]
exclude_keys: Option<Vec<String>>,
#[arg(long)]
stdout: bool,
},
Decrypt {
#[arg(short = 'f', long = "env-file")]
env_files: Vec<PathBuf>,
#[arg(short = 'k', long = "env-keys-file")]
keys_file: Option<PathBuf>,
},
Set {
key: String,
value: String,
#[arg(short = 'f', long = "env-file", default_value = ".env")]
env_file: PathBuf,
#[arg(short = 'k', long = "env-keys-file")]
keys_file: Option<PathBuf>,
#[arg(short = 'p', long)]
plain: bool,
},
Get {
key: Option<String>,
#[arg(short = 'f', long = "env-file", default_value = ".env")]
env_file: PathBuf,
#[arg(short = 'k', long = "env-keys-file")]
keys_file: Option<PathBuf>,
},
Ls {
#[arg(default_value = ".")]
directory: PathBuf,
},
Run {
#[arg(short = 'e', long = "env")]
env: Vec<String>,
#[arg(short = 'f', long = "env-file")]
env_files: Vec<PathBuf>,
#[arg(short = 'k', long = "env-keys-file")]
keys_file: Option<PathBuf>,
#[arg(short = 'o', long)]
overload: bool,
#[arg(last = true, required = true)]
command: Vec<String>,
},
Printenv {
#[arg(short = 'f', long = "env-file")]
env_files: Vec<PathBuf>,
#[arg(short = 'k', long = "env-keys-file")]
keys_file: Option<PathBuf>,
#[arg(long, default_value = "bash")]
format: String,
},
}