62 lines
1.8 KiB
Rust
62 lines
1.8 KiB
Rust
use std::path::PathBuf;
|
|
|
|
use clap::{Parser, Subcommand};
|
|
|
|
/// Tuxcord Reverse Proxy Header Authenthication
|
|
#[derive(Parser, Debug)]
|
|
#[command(version, about, long_about = None)]
|
|
#[command(styles = get_clap_styles())]
|
|
pub struct Args {
|
|
/// Path to the config file
|
|
#[arg(short, default_value = "./config.toml")]
|
|
pub config: PathBuf,
|
|
|
|
#[clap(subcommand)]
|
|
pub command: Option<Commands>,
|
|
}
|
|
|
|
#[derive(Subcommand, Debug)]
|
|
pub enum Commands {
|
|
/// Connects to the selected IPC
|
|
#[cfg(feature = "ipc")]
|
|
Ipc,
|
|
}
|
|
|
|
fn get_clap_styles() -> clap::builder::Styles {
|
|
clap::builder::Styles::styled()
|
|
.usage(
|
|
anstyle::Style::new()
|
|
.bold()
|
|
.underline()
|
|
.fg_color(Some(anstyle::Color::Ansi(anstyle::AnsiColor::Green))),
|
|
)
|
|
.header(
|
|
anstyle::Style::new()
|
|
.bold()
|
|
.underline()
|
|
.fg_color(Some(anstyle::Color::Ansi(anstyle::AnsiColor::Green))),
|
|
)
|
|
.literal(
|
|
anstyle::Style::new().fg_color(Some(anstyle::Color::Ansi(anstyle::AnsiColor::Yellow))),
|
|
)
|
|
.invalid(
|
|
anstyle::Style::new()
|
|
.bold()
|
|
.fg_color(Some(anstyle::Color::Ansi(anstyle::AnsiColor::Red))),
|
|
)
|
|
.error(
|
|
anstyle::Style::new()
|
|
.bold()
|
|
.fg_color(Some(anstyle::Color::Ansi(anstyle::AnsiColor::Red))),
|
|
)
|
|
.valid(
|
|
anstyle::Style::new()
|
|
.bold()
|
|
.underline()
|
|
.fg_color(Some(anstyle::Color::Ansi(anstyle::AnsiColor::Yellow))),
|
|
)
|
|
.placeholder(
|
|
anstyle::Style::new().fg_color(Some(anstyle::Color::Ansi(anstyle::AnsiColor::Blue))),
|
|
)
|
|
}
|