use crate::profile::FamilyName;
use clap::{Parser, Subcommand};
use std::path::PathBuf;
pub use tftio_cli_common::MetaCommand;
use tftio_cli_common::agent::AgentSubcommand;
#[derive(Parser, Debug)]
#[command(name = "prompter")]
#[command(about = "Compose reusable prompt snippets from profile definitions")]
#[command(long_about = None)]
#[command(version)]
pub struct Cli {
#[command(subcommand)]
pub command: Commands,
#[arg(short = 'c', long, value_name = "FILE", global = true)]
pub config: Option<PathBuf>,
#[arg(short = 'j', long, global = true)]
pub json: bool,
}
#[derive(Subcommand, Debug)]
pub enum Commands {
Meta {
#[command(subcommand)]
command: MetaCommand,
},
Init,
List,
Tree,
Validate,
Run {
#[arg(required = true)]
profiles: Vec<String>,
#[arg(long, value_name = "NAME")]
family: Option<FamilyName>,
#[arg(short, long)]
separator: Option<String>,
#[arg(short = 'p', long)]
pre_prompt: Option<String>,
#[arg(short = 'P', long)]
post_prompt: Option<String>,
#[arg(short = 'b', long)]
bare: bool,
},
System {
profiles: Vec<String>,
#[arg(short, long)]
separator: Option<String>,
#[arg(short = 'p', long)]
pre_prompt: Option<String>,
#[arg(short = 'P', long)]
post_prompt: Option<String>,
#[arg(short = 'b', long)]
bare: bool,
},
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Framing {
Full,
Bare,
}
impl Framing {
#[must_use]
pub const fn from_bare_flag(bare: bool) -> Self {
if bare { Self::Bare } else { Self::Full }
}
#[must_use]
pub const fn is_full(self) -> bool {
matches!(self, Self::Full)
}
}
#[derive(Debug)]
pub enum AppMode {
Run {
profiles: Vec<String>,
family: Option<FamilyName>,
separator: Option<String>,
pre_prompt: Option<String>,
post_prompt: Option<String>,
framing: Framing,
config: Option<PathBuf>,
json: bool,
},
List {
config: Option<PathBuf>,
json: bool,
},
Tree {
config: Option<PathBuf>,
json: bool,
},
Validate {
config: Option<PathBuf>,
json: bool,
},
Init,
Version {
json: bool,
},
License,
Help,
Completions {
shell: clap_complete::Shell,
},
Doctor {
json: bool,
},
Agent {
command: AgentSubcommand,
},
}