镜像自地址
https://github.com/Hilbis/Hilbish
已同步 2025-07-10 21:12:02 +00:00
fix: remove duplicate binary suggestions (fixes #105)
这个提交包含在:
父节点
3babf36c43
当前提交
738939e4c9
@ -69,6 +69,8 @@ func binaryComplete(query, ctx string, fields []string) ([]string, string) {
|
||||
}
|
||||
}
|
||||
|
||||
completions = removeDupes(completions)
|
||||
|
||||
return completions, query
|
||||
}
|
||||
|
||||
|
13
main.go
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
|
||||
}
|
||||
|
正在加载...
x
在新工单中引用
屏蔽一个用户