From 6b86157fd59191d6563060aae6c957e1878eabd2 Mon Sep 17 00:00:00 2001 From: sigoden Date: Sun, 29 Oct 2023 17:36:17 +0800 Subject: [PATCH] feat: add `--light-theme` option (#169) --- src/cli.rs | 41 ++++++++++++++++++++++------------------- src/main.rs | 3 +++ 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/src/cli.rs b/src/cli.rs index 1df8ba1a..183a965a 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -4,39 +4,42 @@ use clap::Parser; #[derive(Parser, Debug)] #[command(author, version, about, long_about = None)] pub struct Cli { - /// Choose a model + /// List all models + #[clap(long)] + pub list_models: bool, + /// Choose a llm model #[clap(short, long)] pub model: Option, + /// List all roles + #[clap(long)] + pub list_roles: bool, + /// Select a role + #[clap(short, long)] + pub role: Option, /// Add a GPT prompt #[clap(short, long)] pub prompt: Option, + /// List sessions + #[clap(long)] + pub list_sessions: bool, + /// Initiate or continue a session + #[clap(short = 's', long)] + pub session: Option>, + /// Print information + #[clap(long)] + pub info: bool, + /// Use light theme + #[clap(long)] + pub light_theme: bool, /// Disable syntax highlighting #[clap(short = 'H', long)] pub no_highlight: bool, /// No stream output #[clap(short = 'S', long)] pub no_stream: bool, - /// List all roles - #[clap(long)] - pub list_roles: bool, - /// List all models - #[clap(long)] - pub list_models: bool, - /// Select a role - #[clap(short, long)] - pub role: Option, - /// Print system-wide information - #[clap(long)] - pub info: bool, /// Run in dry run mode #[clap(long)] pub dry_run: bool, - /// List sessions - #[clap(long)] - pub list_sessions: bool, - /// Initiate or continue named session - #[clap(short = 's', long)] - pub session: Option>, /// Input text text: Vec, } diff --git a/src/main.rs b/src/main.rs index de798ec1..d2660a84 100644 --- a/src/main.rs +++ b/src/main.rs @@ -47,6 +47,9 @@ fn main() -> Result<()> { println!("{sessions}"); exit(0); } + if cli.light_theme { + config.write().light_theme = true; + } if cli.dry_run { config.write().dry_run = true; }