2
2
镜像自地址 https://github.com/Hilbis/Hilbish 已同步 2025-07-10 21:12:02 +00:00

fix: remove duplicate binary suggestions (fixes #105)

这个提交包含在:
TorchedSammy 2022-03-07 18:56:22 -04:00
父节点 3babf36c43
当前提交 738939e4c9
签署人:: sammyette
GPG 密钥 ID: 904FC49417B44DCD
共有 2 个文件被更改,包括 15 次插入0 次删除

查看文件

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

13
main.go
查看文件

@ -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
}