Skip to content

Commit

Permalink
autocomplete autoname-sessions
Browse files Browse the repository at this point in the history
  • Loading branch information
sigoden committed Nov 19, 2024
1 parent b22a333 commit 75b2156
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1142,6 +1142,10 @@ impl Config {
list_file_names(self.sessions_dir(), ".yaml")
}

pub fn list_autoname_sessions(&self) -> Vec<String> {
list_file_names(self.sessions_dir().join("_"), ".yaml")
}

pub fn maybe_compress_session(config: GlobalConfig) {
let mut need_compress = false;
{
Expand Down Expand Up @@ -1634,7 +1638,19 @@ impl Config {
.into_iter()
.map(|v| (v.id(), Some(v.description())))
.collect(),
".session" => map_completion_values(self.list_sessions()),
".session" => {
if args[0].starts_with("_/") {
map_completion_values(
self.list_autoname_sessions()
.iter()
.rev()
.map(|v| format!("_/{}", v))
.collect::<Vec<String>>(),
)
} else {
map_completion_values(self.list_sessions())
}
}
".rag" => map_completion_values(Self::list_rags()),
".agent" => map_completion_values(list_agents()),
".starter" => match &self.agent {
Expand Down

0 comments on commit 75b2156

Please sign in to comment.