summaryrefslogtreecommitdiffstats
path: root/src/repl
diff options
context:
space:
mode:
Diffstat (limited to 'src/repl')
-rw-r--r--src/repl/completer.rs7
-rw-r--r--src/repl/mod.rs2
2 files changed, 6 insertions, 3 deletions
diff --git a/src/repl/completer.rs b/src/repl/completer.rs
index 0771001..12e871a 100644
--- a/src/repl/completer.rs
+++ b/src/repl/completer.rs
@@ -1,6 +1,6 @@
use super::{ReplCommand, REPL_COMMANDS};
-use crate::config::GlobalConfig;
+use crate::{config::GlobalConfig, utils::fuzzy_match};
use reedline::{Completer, Span, Suggestion};
use std::collections::HashMap;
@@ -42,7 +42,10 @@ impl Completer for ReplCompleter {
.map(|(v, _)| *v)
.collect::<Vec<&str>>()
.join(" ");
- cmd.name.starts_with(&line) && cmd.name != ".set"
+ if line == "." {
+ return true;
+ }
+ line.starts_with(&cmd.name[..2]) && fuzzy_match(cmd.name, &line)
})
.collect();
diff --git a/src/repl/mod.rs b/src/repl/mod.rs
index 735ad25..6b026b5 100644
--- a/src/repl/mod.rs
+++ b/src/repl/mod.rs
@@ -162,9 +162,9 @@ lazy_static::lazy_static! {
"Regenerate the last response",
AssertState::pass()
),
+ ReplCommand::new(".copy", "Copy the last response", AssertState::pass()),
ReplCommand::new(".set", "Adjust runtime configuration", AssertState::pass()),
ReplCommand::new(".delete", "Delete roles/sessions/RAGs/agents", AssertState::pass()),
- ReplCommand::new(".copy", "Copy the last response", AssertState::pass()),
ReplCommand::new(".exit", "Exit the REPL", AssertState::pass()),
];
static ref COMMAND_RE: Regex = Regex::new(r"^\s*(\.\S*)\s*").unwrap();