2
3
şunun yansıması https://github.com/sammy-ette/Hilbish eşitlendi 2025-08-10 02:52:03 +00:00

fix: remove duplicate binary suggestions (fixes #105)

Bu işleme şunda yer alıyor:
TorchedSammy 2022-03-07 18:56:22 -04:00
ebeveyn 3babf36c43
işleme 738939e4c9
İmzalayan: sammyette
GPG Anahtar Kimliği: 904FC49417B44DCD
2 değiştirilmiş dosya ile 15 ekleme ve 0 silme

Dosyayı Görüntüle

@ -69,6 +69,8 @@ func binaryComplete(query, ctx string, fields []string) ([]string, string) {
}
}
completions = removeDupes(completions)
return completions, query
}

13
main.go
Dosyayı Görüntüle

@ -268,3 +268,16 @@ func expandHome(path string) string {
return strings.Replace(defaultHistDir, "~", homedir, 1)
}
func removeDupes(slice []string) []string {
all := make(map[string]bool)
newSlice := []string{}
for _, item := range slice {
if _, val := all[item]; !val {
all[item] = true
newSlice = append(newSlice, item)
}
}
return newSlice
}