Cleanup previous PR

This commit is contained in:
Kovid Goyal
2025-04-05 09:22:10 +05:30
parent 08eb0aca82
commit 38a2c6eab0
2 changed files with 5 additions and 7 deletions

View File

@@ -4,7 +4,7 @@ package cli
import ( import (
"fmt" "fmt"
"sort" "slices"
"strings" "strings"
"kitty/tools/cli/markup" "kitty/tools/cli/markup"
@@ -23,7 +23,6 @@ func fish_completion_script(commands []string) (string, error) {
} }
if len(commands) == 0 { if len(commands) == 0 {
commands = append(commands, utils.Keys(all_commands)...) commands = append(commands, utils.Keys(all_commands)...)
sort.Strings(commands)
} }
script := strings.Builder{} script := strings.Builder{}
script.WriteString(`function __ksi_completions script.WriteString(`function __ksi_completions
@@ -33,6 +32,7 @@ func fish_completion_script(commands []string) (string, error) {
end end
`) `)
slices.Sort(commands)
for _, cmd := range commands { for _, cmd := range commands {
if all_commands[cmd] { if all_commands[cmd] {
fmt.Fprintf(&script, "complete -f -c %s -a \"(__ksi_completions)\"\n", cmd) fmt.Fprintf(&script, "complete -f -c %s -a \"(__ksi_completions)\"\n", cmd)

View File

@@ -8,8 +8,8 @@ import (
"os" "os"
"os/exec" "os/exec"
"slices" "slices"
"strings"
"strconv" "strconv"
"strings"
"time" "time"
"golang.org/x/sys/unix" "golang.org/x/sys/unix"
@@ -137,10 +137,8 @@ func ShowHelpInPager(text string) {
} }
func getDeterministicTimestamp() time.Time { func getDeterministicTimestamp() time.Time {
if epochStr, exists := os.LookupEnv("SOURCE_DATE_EPOCH"); exists { if epoch, err := strconv.ParseInt(os.Getenv("SOURCE_DATE_EPOCH"), 10, 64); err == nil {
if epoch, err := strconv.ParseInt(epochStr, 10, 64); err == nil { return time.Unix(epoch, 0).UTC()
return time.Unix(epoch, 0).UTC()
}
} }
return time.Now() return time.Now()
} }