use clap::Subcommand;
use std::path::PathBuf;
#[derive(Subcommand, Debug)]
pub enum SnapshotCmd {
Save {
name: String,
#[arg(long, default_value = "state")]
state_dir: PathBuf,
},
List {
#[arg(long, default_value = "state")]
state_dir: PathBuf,
#[arg(long)]
json: bool,
},
Restore {
name: String,
#[arg(long, default_value = "state")]
state_dir: PathBuf,
#[arg(long)]
yes: bool,
},
Delete {
name: String,
#[arg(long, default_value = "state")]
state_dir: PathBuf,
},
}
#[derive(Subcommand, Debug)]
pub enum GenerationCmd {
List {
#[arg(long, default_value = "state")]
state_dir: PathBuf,
#[arg(long)]
json: bool,
},
Gc {
#[arg(long, default_value = "5")]
keep: u32,
#[arg(long, default_value = "state")]
state_dir: PathBuf,
},
Diff {
from: u32,
to: u32,
#[arg(long, default_value = "state")]
state_dir: PathBuf,
#[arg(long)]
json: bool,
},
}
#[derive(Debug, Clone, clap::ValueEnum)]
pub enum CompletionShell {
Bash,
Zsh,
Fish,
}
#[derive(Subcommand, Debug)]
pub enum WorkspaceCmd {
New {
name: String,
},
List,
Select {
name: String,
},
Delete {
name: String,
#[arg(long)]
yes: bool,
},
Current,
}
#[derive(Subcommand, Debug)]
pub enum EnvironmentsCmd {
List {
#[arg(short, long, default_value = "forjar.yaml")]
file: PathBuf,
#[arg(long)]
json: bool,
},
Diff {
source: String,
target: String,
#[arg(short, long, default_value = "forjar.yaml")]
file: PathBuf,
#[arg(long)]
json: bool,
},
Rollback {
env: String,
#[arg(long, default_value = "state")]
state_dir: PathBuf,
#[arg(long, default_value = "1")]
generations: u32,
#[arg(long)]
yes: bool,
#[arg(long)]
json: bool,
},
History {
env: String,
#[arg(long, default_value = "state")]
state_dir: PathBuf,
#[arg(long, default_value = "20")]
limit: usize,
#[arg(long)]
json: bool,
},
}
#[derive(clap::Args, Debug)]
pub struct PromoteArgs {
#[arg(short, long, default_value = "forjar.yaml")]
pub file: PathBuf,
#[arg(short, long)]
pub target: String,
#[arg(long)]
pub yes: bool,
#[arg(long)]
pub dry_run: bool,
#[arg(long)]
pub json: bool,
}
#[derive(Subcommand, Debug)]
pub enum RulesCmd {
Validate {
#[arg(short, long, default_value = "forjar.yaml")]
file: PathBuf,
#[arg(long)]
json: bool,
},
Coverage {
#[arg(short, long, default_value = "forjar.yaml")]
file: PathBuf,
#[arg(long)]
json: bool,
},
}
#[derive(Subcommand, Debug)]
pub enum PluginCmd {
List {
#[arg(long, default_value = "plugins")]
plugin_dir: PathBuf,
#[arg(long)]
json: bool,
},
Verify {
manifest: PathBuf,
#[arg(long)]
json: bool,
},
Init {
name: String,
#[arg(long)]
output: Option<PathBuf>,
#[arg(long)]
json: bool,
},
Install {
source: String,
#[arg(long, default_value = "plugins")]
plugin_dir: PathBuf,
#[arg(long)]
json: bool,
},
Build {
#[arg(long)]
path: PathBuf,
#[arg(long, default_value = "plugins")]
output: Option<PathBuf>,
#[arg(long)]
json: bool,
},
Run {
name: String,
#[arg(long, default_value = "check")]
operation: String,
#[arg(long, default_value = "plugins")]
plugin_dir: PathBuf,
#[arg(long, default_value = "{}")]
config: String,
#[arg(long)]
json: bool,
},
Remove {
name: String,
#[arg(long, default_value = "plugins")]
plugin_dir: PathBuf,
#[arg(long)]
yes: bool,
#[arg(long)]
json: bool,
},
}
#[derive(clap::Args, Debug)]
pub struct StateEncryptArgs {
#[arg(long, default_value = "state")]
pub state_dir: PathBuf,
#[arg(long)]
pub passphrase: Option<String>,
#[arg(long)]
pub json: bool,
}
#[derive(clap::Args, Debug)]
pub struct StateDecryptArgs {
#[arg(long, default_value = "state")]
pub state_dir: PathBuf,
#[arg(long)]
pub passphrase: Option<String>,
#[arg(long)]
pub json: bool,
}
#[derive(clap::Args, Debug)]
pub struct StateRekeyArgs {
#[arg(long, default_value = "state")]
pub state_dir: PathBuf,
#[arg(long)]
pub old_passphrase: Option<String>,
#[arg(long)]
pub new_passphrase: Option<String>,
#[arg(long)]
pub json: bool,
}
#[derive(Subcommand, Debug)]
pub enum SecretsCmd {
Encrypt {
value: String,
#[arg(short, long, required = true)]
recipient: Vec<String>,
},
Decrypt {
value: String,
#[arg(short, long)]
identity: Option<PathBuf>,
},
Keygen,
View {
#[arg(short, long, default_value = "forjar.yaml")]
file: PathBuf,
#[arg(short, long)]
identity: Option<PathBuf>,
},
Rekey {
#[arg(short, long, default_value = "forjar.yaml")]
file: PathBuf,
#[arg(short, long)]
identity: Option<PathBuf>,
#[arg(short, long, required = true)]
recipient: Vec<String>,
},
Rotate {
#[arg(short, long, default_value = "forjar.yaml")]
file: PathBuf,
#[arg(short, long)]
identity: Option<PathBuf>,
#[arg(short, long, required = true)]
recipient: Vec<String>,
#[arg(long)]
re_encrypt: bool,
#[arg(long, default_value = "state")]
state_dir: PathBuf,
},
}