use clap::{Parser, Subcommand};
use std::path::PathBuf;
#[derive(Parser)]
#[command(author, version, about, long_about = None)]
pub struct Cli {
#[command(subcommand)]
pub command: Commands,
}
#[derive(Subcommand)]
pub enum Commands {
Secrets {
#[command(subcommand)]
cmd: SecretsCommands,
},
Users {
#[command(subcommand)]
cmd: UserCommands,
},
Website {
#[command(subcommand)]
cmd: WebsiteCommands,
},
Login(LoginArgs),
Keygen(KeygenArgs),
Unseal { chamber_key: String },
Upload(UploadArgs)
}
#[derive(Parser, Clone)]
pub struct LoginArgs {
#[arg(long, short = 'p')]
pub password: Option<String>,
}
#[derive(Parser, Clone)]
pub struct ListArgs {
#[arg(long, short = 't')]
pub tags: Option<String>,
}
#[derive(Parser, Clone)]
pub struct KeyArgs {
#[arg(long, short = 'k')]
pub key: Option<String>,
}
#[derive(Parser, Clone)]
pub struct KeygenArgs {
#[arg(long, short = 'k')]
pub key: Option<String>,
#[arg(long, short = 'o')]
pub output: Option<PathBuf>,
}
#[derive(Subcommand)]
pub enum UserCommands {
Create,
}
#[derive(Subcommand)]
pub enum SecretsCommands {
Get(KeyArgs),
Set { key: String, value: String },
Update {
key: String,
#[arg(short, long, value_parser, num_args = 1.., value_delimiter = ' ')]
tags: Vec<String>,
},
List(ListArgs),
Rm(KeyArgs),
}
#[derive(Subcommand)]
pub enum WebsiteCommands {
Get,
Set { value: String },
}
#[derive(Parser, Clone)]
pub struct UploadArgs {
#[arg(long, short)]
pub key: Option<String>
}