summaryrefslogtreecommitdiffstats
path: root/src/config.rs
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2023-03-04 09:02:57 +0800
committerGitHub <noreply@github.com>2023-03-04 09:02:57 +0800
commit0fa1ae215ac1434591968818f8f75ad5b35d52ec (patch)
tree2417bc0e95fad6886dd414cf407bb9fc0dbf3108 /src/config.rs
parent3ffebce8bbc530429086302ec4f9a95268c25d07 (diff)
downloadaichat-0fa1ae215ac1434591968818f8f75ad5b35d52ec.tar.gz
feat: support highlight reply markdown (#3)
* feat: support highlight reply markdown * migrate markdown highlighter from termimad to mdcat * optimize render No need to clear screen when there is no newline in reply token * handle ctrl-c when rendering stream * update readme * fix ctrlc don't abort acquire_stream when establish connection * ensure render_stream's dtect_ctrlc is exit before next readline This will make reedline don't throw err 'The cursor position could not be read within a normal duration'
Diffstat (limited to 'src/config.rs')
-rw-r--r--src/config.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/config.rs b/src/config.rs
index c3ebf3c..cce6b6a 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -24,6 +24,9 @@ pub struct Config {
/// Whether to persistently save chat messages
#[serde(default)]
pub save: bool,
+ /// Whether to highlight reply message
+ #[serde(default)]
+ pub highlight: bool,
/// Set proxy
pub proxy: Option<String>,
/// Used only for debugging
@@ -172,6 +175,14 @@ fn create_config_file(config_path: &Path) -> Result<()> {
raw_config.push_str("save: true\n");
}
+ let ans = Confirm::new("Whether to highlight reply message?")
+ .with_default(true)
+ .prompt()
+ .map_err(confirm_map_err)?;
+ if ans {
+ raw_config.push_str("highlight: true\n");
+ }
+
std::fs::write(config_path, raw_config)
.map_err(|err| anyhow!("Failed to write to config file, {err}"))?;
Ok(())