From e8461b846260299cb0a60de143950fbf5e91adfa Mon Sep 17 00:00:00 2001 From: sigoden Date: Wed, 8 Nov 2023 07:08:48 +0800 Subject: refactor: output info includes auto_copy and light_theme (#230) --- README.md | 3 ++- src/config/mod.rs | 7 ++++--- src/repl/mod.rs | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index fd40161..0b63f36 100644 --- a/README.md +++ b/README.md @@ -163,12 +163,13 @@ Press Ctrl+C to abort readline, Ctrl+D to exit the REPL 〉.info model openai:gpt-3.5-turbo temperature - +dry_run false save true highlight true light_theme false wrap no wrap_code false -dry_run false +auto_copy false keybindings emacs prelude - config_file /home/alice/.config/aichat/config.yaml diff --git a/src/config/mod.rs b/src/config/mod.rs index 05c681b..5219727 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -46,12 +46,12 @@ pub struct Config { /// GPT temperature, between 0 and 2 #[serde(rename(serialize = "temperature", deserialize = "temperature"))] pub default_temperature: Option, + /// Dry-run flag + pub dry_run: bool, /// Whether to save the message pub save: bool, /// Whether to disable highlight pub highlight: bool, - /// Dry-run flag - pub dry_run: bool, /// Whether to use a light theme pub light_theme: bool, /// Specify the text-wrapping mode (no, auto, ) @@ -366,9 +366,10 @@ impl Config { ("dry_run", self.dry_run.to_string()), ("save", self.save.to_string()), ("highlight", self.highlight.to_string()), + ("light_theme", self.light_theme.to_string()), ("wrap", wrap), ("wrap_code", self.wrap_code.to_string()), - ("light_theme", self.light_theme.to_string()), + ("auto_copy", self.auto_copy.to_string()), ("keybindings", self.keybindings.stringify().into()), ("prelude", prelude), ("config_file", display_path(&Self::config_file()?)), diff --git a/src/repl/mod.rs b/src/repl/mod.rs index 1143ab9..50330b6 100644 --- a/src/repl/mod.rs +++ b/src/repl/mod.rs @@ -43,7 +43,7 @@ const REPL_COMMANDS: [(&str, &str); 13] = [ lazy_static! { static ref COMMAND_RE: Regex = Regex::new(r"^\s*(\.\S*)\s*").unwrap(); - static ref MULTILINE_RE: Regex = Regex::new(r#"(?ms)^\s*"""\s*(.*)\s*"""\s*$"#).unwrap(); + static ref MULTILINE_RE: Regex = Regex::new(r#"(?s)^\s*"""\s*(.*)\s*"""\s*$"#).unwrap(); } pub struct Repl { -- cgit v1.2.3