use std::path::PathBuf;
use crate::api::execute::Execution;
pub mod container;
pub mod create;
pub mod database;
pub mod list;
pub mod terminal;
pub mod update;
#[derive(Debug, clap::Parser)]
#[command(name = "komodo-cli", version, about = "", author)]
pub struct CliArgs {
#[command(subcommand)]
pub command: Command,
#[arg(long, short = 'p')]
pub profile: Option<String>,
#[arg(long, short = 'c')]
pub config_path: Option<Vec<PathBuf>>,
#[arg(long, short = 'm')]
pub config_keyword: Option<Vec<String>>,
#[arg(alias = "debug", long, short = 'd')]
pub debug_startup: Option<bool>,
}
#[derive(Debug, Clone, clap::Subcommand)]
pub enum Command {
#[clap(alias = "cfg", alias = "cf")]
Config {
#[arg(long, short = 'a', default_value_t = false)]
all_profiles: bool,
#[arg(long, action)]
unsanitized: bool,
},
#[clap(alias = "core")]
CoreInfo,
#[clap(alias = "ls", alias = "resources")]
List(list::List),
#[clap(
alias = "x",
alias = "run",
alias = "deploy",
alias = "dep",
alias = "send"
)]
Execute(Execute),
#[clap(alias = "new", alias = "cr")]
Create {
#[command(subcommand)]
command: create::CreateCommand,
},
#[clap(alias = "set")]
Update {
#[command(subcommand)]
command: update::UpdateCommand,
},
#[clap(alias = "ps", alias = "cn", alias = "containers")]
Container(container::Container),
#[clap(alias = "i")]
Inspect(container::InspectContainer),
#[clap(alias = "ssh")]
Connect(terminal::Connect),
Exec(terminal::Exec),
Attach(terminal::Attach),
#[clap(alias = "k")]
Key {
#[command(subcommand)]
command: mogh_pki::cli::KeyCommand,
},
#[clap(alias = "db")]
Database {
#[command(subcommand)]
command: database::DatabaseCommand,
},
}
#[derive(Debug, Clone, clap::Parser)]
pub struct Execute {
#[command(subcommand)]
pub execution: Execution,
#[arg(long, short = 'a')]
pub host: Option<String>,
#[arg(long, short = 'k')]
pub key: Option<String>,
#[arg(long, short = 's')]
pub secret: Option<String>,
#[arg(long, short = 'y', default_value_t = false)]
pub yes: bool,
}
#[derive(
Debug, Clone, Copy, Default, strum::Display, clap::ValueEnum,
)]
#[strum(serialize_all = "lowercase")]
pub enum CliFormat {
#[default]
#[clap(alias = "t")]
Table,
#[clap(alias = "j")]
Json,
}
#[derive(
Debug, Clone, Copy, Default, clap::ValueEnum, strum::Display,
)]
#[strum(serialize_all = "lowercase")]
pub enum CliEnabled {
#[default]
#[clap(alias = "y", alias = "true", alias = "t")]
Yes,
#[clap(alias = "n", alias = "false", alias = "f")]
No,
}
impl From<CliEnabled> for bool {
fn from(value: CliEnabled) -> Self {
match value {
CliEnabled::Yes => true,
CliEnabled::No => false,
}
}
}