feat(history): add Atuin context scopes
This commit is contained in:
+4
-4
@@ -49,18 +49,18 @@ func MergeResults(query string, mode string) []spec.Suggestion {
|
||||
|
||||
if mode == "history" {
|
||||
aliases := spec.GetAliasesCopy()
|
||||
histResults, _ := integration.SearchHistory(query, aliases)
|
||||
histResults, _ := integration.SearchHistoryIn(query, aliases, spec.GetCWD())
|
||||
|
||||
// scale confidence based on recency (index in histResults) so the most recent commands stay on top
|
||||
baseConf := 75
|
||||
for i, h := range histResults {
|
||||
conf := max(baseConf-(i*2), 60)
|
||||
|
||||
|
||||
icon := "history"
|
||||
if h.Source == "atuin" {
|
||||
icon = "atuin"
|
||||
}
|
||||
|
||||
|
||||
addSuggestion(spec.Suggestion{
|
||||
Cmd: h.Cmd,
|
||||
Desc: h.Source,
|
||||
@@ -97,7 +97,7 @@ func MergeResults(query string, mode string) []spec.Suggestion {
|
||||
if len(tokens) > 0 {
|
||||
rootCmd = tokens[0]
|
||||
}
|
||||
|
||||
|
||||
ctxTimeout, cancel := context.WithTimeout(context.Background(), 500*time.Millisecond)
|
||||
defer cancel()
|
||||
store, _ := scoring.GetFrecencyStore()
|
||||
|
||||
Reference in New Issue
Block a user