terrazzo-terminal 0.2.7

A simple web-based terminal emulator built on Terrazzo.
use std::path::PathBuf;

use clap::Parser;
use clap::ValueEnum;

#[derive(Parser, Debug, Default)]
#[command(version, about, long_about = None)]
pub struct Cli {
    /// Whether to start or stop the terrazzo-terminal daemon.
    #[arg(long, short, value_enum, default_value_t = Action::Run)]
    pub action: Action,

    /// Read the password for `set-password` from stdin instead of prompting.
    #[arg(long)]
    pub password_stdin: bool,

    /// The TCP host to listen to.
    #[arg(long)]
    pub host: Option<String>,

    /// The file to store the config.
    #[arg(long)]
    pub config_file: Option<PathBuf>,

    /// The TCP port to listen to.
    #[arg(long)]
    pub port: Option<u16>,

    /// Additional TCP ports to listen to.
    #[arg(long)]
    pub ports: Vec<u16>,

    /// The shell command to run for new terminals.
    #[arg(long)]
    pub terminal_shell: Option<String>,

    /// The folder where deleted text-editor files are moved.
    #[arg(long)]
    pub trash: Option<PathBuf>,

    /// The folder, relative to a Git repository root, where deleted Git files are moved.
    #[arg(long)]
    pub git_trash: Option<PathBuf>,

    /// A temp file to write the port allocated dynamically.
    #[arg(long)]
    pub set_current_endpoint: Option<PathBuf>,

    /// The file to store the pid of the daemon while it is running.
    #[arg(long)]
    pub pidfile: Option<PathBuf>,

    /// The file to the store private Root CA.
    #[arg(long)]
    pub private_root_ca: Option<PathBuf>,

    /// If using mesh: the Client name.
    #[arg(long)]
    pub client_name: Option<String>,

    /// If using mesh: the Gateway endpoint
    #[arg(long)]
    pub gateway_url: Option<String>,

    /// If using mesh: the Gateway CA
    #[arg(long)]
    pub gateway_pki: Option<PathBuf>,

    /// If using mesh: the AuthCode to get a client certificate
    #[arg(long, default_value_t = String::default())]
    pub auth_code: String,

    /// If using mesh: the file to store the client certificate
    #[arg(long)]
    pub client_certificate: Option<PathBuf>,
}

#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, ValueEnum)]
pub enum Action {
    /// Run the server in the foreground
    #[default]
    Run,

    /// Run the server in the background as a daemon
    Start,

    /// Stop the daemon
    Stop,

    /// Restart the daemon
    Restart,

    /// Sets the password
    SetPassword,

    /// Lists all installed asset source paths
    #[cfg(feature = "debug")]
    ListAssets,
}