Use stdlib maps/slices

This commit is contained in:
Kovid Goyal
2024-05-04 14:34:40 +05:30
parent 4998fe66b9
commit e1b367e1b3
27 changed files with 55 additions and 60 deletions

View File

@@ -10,6 +10,7 @@ import (
"io"
"os"
"path/filepath"
"slices"
"strings"
"sync"
@@ -17,9 +18,6 @@ import (
"kitty/tools/tui/loop"
"kitty/tools/utils"
"kitty/tools/utils/images"
"golang.org/x/exp/maps"
"golang.org/x/exp/slices"
)
var _ = fmt.Print
@@ -365,7 +363,7 @@ func run_get_loop(opts *Options, args []string) (err error) {
}
}
if len(requested_mimes) > 0 {
lp.QueueWriteString(encode(basic_metadata, strings.Join(maps.Keys(requested_mimes), " ")))
lp.QueueWriteString(encode(basic_metadata, strings.Join(utils.Keys(requested_mimes), " ")))
} else {
lp.Quit(0)
}

View File

@@ -5,6 +5,7 @@ package diff
import (
"fmt"
"regexp"
"slices"
"strings"
"sync"
@@ -12,8 +13,6 @@ import (
"kitty/tools/utils"
"kitty/tools/utils/images"
"kitty/tools/wcswidth"
"golang.org/x/exp/slices"
)
var _ = fmt.Print

View File

@@ -10,6 +10,7 @@ import (
"os/exec"
"path/filepath"
"regexp"
"slices"
"strconv"
"strings"
"sync"
@@ -18,7 +19,6 @@ import (
"github.com/dlclark/regexp2"
"github.com/seancfoley/ipaddress-go/ipaddr"
"golang.org/x/exp/slices"
"kitty"
"kitty/tools/config"

View File

@@ -13,6 +13,7 @@ import (
"io"
"io/fs"
"kitty"
"maps"
"net/url"
"os"
"os/exec"
@@ -21,6 +22,7 @@ import (
"path"
"path/filepath"
"regexp"
"slices"
"strconv"
"strings"
"time"
@@ -36,8 +38,6 @@ import (
"kitty/tools/utils/shlex"
"kitty/tools/utils/shm"
"golang.org/x/exp/maps"
"golang.org/x/exp/slices"
"golang.org/x/sys/unix"
)
@@ -411,7 +411,7 @@ func prepare_script(script string, replacements map[string]string) string {
if _, found := replacements["EXPORT_HOME_CMD"]; !found {
replacements["EXPORT_HOME_CMD"] = ""
}
keys := maps.Keys(replacements)
keys := utils.Keys(replacements)
for i, key := range keys {
keys[i] = "\\b" + key + "\\b"
}

View File

@@ -5,8 +5,10 @@ package themes
import (
"fmt"
"io"
"maps"
"path/filepath"
"regexp"
"slices"
"strings"
"time"
@@ -16,9 +18,6 @@ import (
"kitty/tools/tui/readline"
"kitty/tools/utils"
"kitty/tools/wcswidth"
"golang.org/x/exp/maps"
"golang.org/x/exp/slices"
)
var _ = fmt.Print

View File

@@ -11,6 +11,7 @@ import (
"io/fs"
"os"
"path/filepath"
"slices"
"strconv"
"strings"
"time"
@@ -25,7 +26,6 @@ import (
"kitty/tools/utils/humanize"
"kitty/tools/wcswidth"
"golang.org/x/exp/slices"
"golang.org/x/sys/unix"
)

View File

@@ -11,6 +11,7 @@ import (
"io/fs"
"os"
"path/filepath"
"slices"
"strconv"
"strings"
"syscall"
@@ -18,7 +19,6 @@ import (
"unicode/utf8"
"golang.org/x/exp/constraints"
"golang.org/x/exp/slices"
"kitty"
"kitty/tools/cli/markup"

View File

@@ -8,6 +8,7 @@ import (
"os"
"os/exec"
"path/filepath"
"slices"
"strconv"
"strings"
"unicode"
@@ -21,8 +22,6 @@ import (
"kitty/tools/utils"
"kitty/tools/utils/style"
"kitty/tools/wcswidth"
"golang.org/x/exp/slices"
)
var _ = fmt.Print

View File

@@ -4,6 +4,7 @@ package unicode_input
import (
"fmt"
"slices"
"strconv"
"strings"
@@ -11,8 +12,6 @@ import (
"kitty/tools/utils"
"kitty/tools/utils/style"
"kitty/tools/wcswidth"
"golang.org/x/exp/slices"
)
var _ = fmt.Print