use clap::{Parser, Subcommand};
#[derive(clap::ValueEnum, Clone)]
pub enum ClientType {
Publish,
Subscribe,
Query,
}
#[derive(clap::ValueEnum, Clone)]
pub enum LogLevel {
Trace,
Warn,
Info,
Error,
Debug,
}
#[derive(Subcommand)]
pub enum ServerType {
Tcp {
host: String,
port: u16,
#[clap(short, long)]
cert: Option<String>,
#[clap(short = 'p', long)]
cert_password: Option<String>,
},
Unix {
path: String,
},
}
#[derive(Parser)]
#[clap(author, version, about, long_about = None)]
pub struct Cli {
#[clap(subcommand)]
pub command: Commands,
#[clap(long, global = true)]
pub log_level: Option<LogLevel>,
}
#[derive(Subcommand)]
pub enum Commands {
Server {
#[clap(subcommand)]
server_type: ServerType,
},
Client {
#[clap(subcommand)]
server_tyepe: ServerType,
client_type: ClientType,
topic: String,
message: Option<String>,
},
}