diff options
| author | sigoden <sigoden@gmail.com> | 2023-11-08 11:19:45 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-08 11:19:45 +0800 |
| commit | 15efa17963186601cea5f238773b05a659dea9c8 (patch) | |
| tree | 3d1617ca61963e8e4c1f373d42f1edc489d130b5 | |
| parent | 819f50d9b16cb2afef5e3865de64bd0698910b27 (diff) | |
| download | aichat-15efa17963186601cea5f238773b05a659dea9c8.tar.gz | |
refactor: use ::: as multipline input indicator, deprecate """ (#232)
| -rw-r--r-- | README.md | 6 | ||||
| -rw-r--r-- | src/repl/completer.rs | 2 | ||||
| -rw-r--r-- | src/repl/mod.rs | 8 |
3 files changed, 8 insertions, 8 deletions
@@ -152,7 +152,7 @@ The Chat REPL supports: .read Import from file and submit .exit Exit the REPL -Type """ to begin multi-line editing, type """ to end it. +Type ::: to begin multi-line editing, type ::: to end it. Press Ctrl+C to abort readline, Ctrl+D to exit the REPL ``` @@ -222,9 +222,9 @@ temperature: null Temporarily use a role to send a message. ``` -〉""" .role emoji +〉::: .role emoji hello world -""" +::: 👋🌍 〉 diff --git a/src/repl/completer.rs b/src/repl/completer.rs index 059c7ca..f9006e2 100644 --- a/src/repl/completer.rs +++ b/src/repl/completer.rs @@ -13,7 +13,7 @@ impl Completer for ReplCompleter { if parts.is_empty() { return suggestions; } - if parts[0].0 == r#"""""# { + if parts[0].0 == r#":::"# { parts.remove(0); } diff --git a/src/repl/mod.rs b/src/repl/mod.rs index 50330b6..8ffb36c 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#"(?s)^\s*"""\s*(.*)\s*"""\s*$"#).unwrap(); + static ref MULTILINE_RE: Regex = Regex::new(r"(?s)^\s*:::\s*(.*)\s*:::\s*$").unwrap(); } pub struct Repl { @@ -144,7 +144,7 @@ impl Repl { } }, ".edit" => { - println!(r#"Deprecated. Use """ instead."#); + println!(r#"Deprecated. Use ::: instead."#); } ".model" => match args { Some(name) => { @@ -329,7 +329,7 @@ struct ReplValidator; impl Validator for ReplValidator { fn validate(&self, line: &str) -> ValidationResult { let line = line.trim(); - if line.starts_with(r#"""""#) && !line[3..].ends_with(r#"""""#) { + if line.starts_with(r#":::"#) && !line[3..].ends_with(r#":::"#) { ValidationResult::Incomplete } else { ValidationResult::Complete @@ -350,7 +350,7 @@ fn dump_repl_help() { println!( r###"{head} -Type """ to begin multi-line editing, type """ to end it. +Type ::: to begin multi-line editing, type ::: to end it. Press Ctrl+C to abort aichat, Ctrl+D to exit the REPL"###, ); } |
