diff --git a/tools/cli/fish.go b/tools/cli/fish.go index c9068fcb8..1c944f55f 100644 --- a/tools/cli/fish.go +++ b/tools/cli/fish.go @@ -8,6 +8,8 @@ import ( "kitty/tools/cli/markup" "kitty/tools/utils" + + "golang.org/x/exp/maps" ) var _ = fmt.Print @@ -21,7 +23,7 @@ func fish_completion_script(commands []string) (string, error) { "kitten": true, } if len(commands) == 0 { - commands = append(commands, utils.Keys(all_commands)...) + commands = append(commands, maps.Keys(all_commands)...) } script := strings.Builder{} script.WriteString(`function __ksi_completions diff --git a/tools/cmd/clipboard/read.go b/tools/cmd/clipboard/read.go index 86448906f..c9177e140 100644 --- a/tools/cmd/clipboard/read.go +++ b/tools/cmd/clipboard/read.go @@ -17,6 +17,7 @@ import ( "kitty/tools/utils" "kitty/tools/utils/images" + "golang.org/x/exp/maps" "golang.org/x/exp/slices" ) @@ -363,7 +364,7 @@ func run_get_loop(opts *Options, args []string) (err error) { } } if len(requested_mimes) > 0 { - lp.QueueWriteString(encode(basic_metadata, strings.Join(utils.Keys(requested_mimes), " "))) + lp.QueueWriteString(encode(basic_metadata, strings.Join(maps.Keys(requested_mimes), " "))) } else { lp.Quit(0) } diff --git a/tools/utils/misc.go b/tools/utils/misc.go index 89c227f9a..5e54fd5de 100644 --- a/tools/utils/misc.go +++ b/tools/utils/misc.go @@ -120,30 +120,6 @@ func Min[T constraints.Ordered](a T, items ...T) (ans T) { return ans } -// Keys returns the keys of the map m. -// The keys will be an indeterminate order. -func Keys[M ~map[K]V, K comparable, V any](m M) []K { - r := make([]K, len(m)) - i := 0 - for k := range m { - r[i] = k - i++ - } - return r -} - -// Values returns the values of the map m. -// The values will be an indeterminate order. -func Values[M ~map[K]V, K comparable, V any](m M) []V { - r := make([]V, len(m)) - i := 0 - for _, v := range m { - r[i] = v - i++ - } - return r -} - func Memset[T any](dest []T, pattern ...T) []T { if len(pattern) == 0 { var zero T