diff options
| author | sigoden <sigoden@gmail.com> | 2023-03-06 09:27:49 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-06 09:27:49 +0800 |
| commit | cfb46ca0de8493a1ab5026cd44f88f092b26f91d (patch) | |
| tree | 5b160da9ff653ee5158d5434e5aa6027515c1c92 /src | |
| parent | 7def9aef0179ad11ac29e401da8856e972c6ae7b (diff) | |
| download | aichat-cfb46ca0de8493a1ab5026cd44f88f092b26f91d.tar.gz | |
feat: add `--no-highlight` option (#24)
Diffstat (limited to 'src')
| -rw-r--r-- | src/cli.rs | 5 | ||||
| -rw-r--r-- | src/main.rs | 4 | ||||
| -rw-r--r-- | src/repl/mod.rs | 2 |
3 files changed, 8 insertions, 3 deletions
@@ -6,9 +6,12 @@ pub struct Cli { /// List all roles #[clap(short = 'L', long)] pub list_roles: bool, - /// Specify the role that the AI will play + /// Select a role #[clap(short, long)] pub role: Option<String>, + /// Turn off highlight + #[clap(short = 'H', long)] + pub no_highlight: bool, /// Input text, if no input text, enter interactive mode text: Vec<String>, } diff --git a/src/main.rs b/src/main.rs index 0f12db5..884a56f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -43,10 +43,12 @@ fn main() -> Result<()> { None => None, }; config.borrow_mut().role = role; + if cli.no_highlight { + config.borrow_mut().highlight = false; + } let client = ChatGptClient::init(config.clone())?; if atty::isnt(atty::Stream::Stdin) { let mut input = String::new(); - config.borrow_mut().highlight = false; stdin().read_to_string(&mut input)?; if let Some(text) = text { input = format!("{text}\n{input}"); diff --git a/src/repl/mod.rs b/src/repl/mod.rs index 30f09fe..826ec6a 100644 --- a/src/repl/mod.rs +++ b/src/repl/mod.rs @@ -16,7 +16,7 @@ pub use self::handler::*; pub const REPL_COMMANDS: [(&str, &str, bool); 12] = [ (".info", "Print the information", false), (".set", "Modify the configuration temporarily", false), - (".role", "Specifies the role the AI will play", false), + (".role", "Select a role", false), (".clear role", "Clear the currently selected role", false), (".prompt", "Add prompt, aka create a temporary role", true), (".history", "Print the history", false), |
