mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-16 21:45:03 +02:00
Code to get exe name for usage message
This commit is contained in:
23
tools/utils/misc.go
Normal file
23
tools/utils/misc.go
Normal file
@@ -0,0 +1,23 @@
|
||||
// License: GPLv3 Copyright: 2022, Kovid Goyal, <kovid at kovidgoyal.net>
|
||||
|
||||
package utils
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
var _ = fmt.Print
|
||||
|
||||
func Reverse[T any](s []T) {
|
||||
for i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 {
|
||||
s[i], s[j] = s[j], s[i]
|
||||
}
|
||||
}
|
||||
|
||||
func Reversed[T any](s []T) []T {
|
||||
ans := make([]T, len(s))
|
||||
for i, x := range s {
|
||||
ans[len(s)-1-i] = x
|
||||
}
|
||||
return ans
|
||||
}
|
||||
Reference in New Issue
Block a user