From 8b25bdac0fc321f4b4d9bb53c4f36fdc9ab2bb80 Mon Sep 17 00:00:00 2001 From: verse91 Date: Sat, 11 Apr 2026 21:36:08 +0700 Subject: [PATCH] fix(spec): remove sync.Once so we can always up-to-date with shell config --- commands/core/spec.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/commands/core/spec.go b/commands/core/spec.go index 82a5d7c..1082cd4 100644 --- a/commands/core/spec.go +++ b/commands/core/spec.go @@ -4,7 +4,6 @@ import ( "os" "path/filepath" "strings" - "sync" ) type GeneratorFunc func(tokens []string, prefix string, partial string) []Suggestion @@ -46,7 +45,6 @@ var ( registry = map[string]*Spec{} pathCmds = make(map[string]bool) shellAliases = make(map[string]string) // alias name -> target command - pathOnce sync.Once ) // scanShellAliases parses shell config files for aliases @@ -152,7 +150,10 @@ func Register(s *Spec) { // // priority: file/dir -> subcommands -> options func Lookup(input string) []Suggestion { - pathOnce.Do(scanExternalCommands) + shellAliases = make(map[string]string) + pathCmds = make(map[string]bool) + scanExternalCommands() + tokens := tokenize(input) // Token Injection: resolve shell alias (e.g. gca -> git commit -a) @@ -272,7 +273,6 @@ func Lookup(input string) []Suggestion { } func topLevelSuggestions(query string) []Suggestion { - pathOnce.Do(scanExternalCommands) results, seen := []Suggestion{}, make(map[string]bool) // 1. Manual specs (High Priority)