Versions in this module Expand all Collapse all v0 v0.2.0 Dec 31, 2024 Changes in this version + const DEFAULT_IO_BUFFER_SIZE + const ESCAPE_CODE_SAFE_ALPHABET + const HUMAN_ALPHABET + var CacheDir = sync.OnceValue(func() (cache_dir string) { ... }) + var ConfigDir = sync.OnceValue(func() (config_dir string) { ... }) + var DefaultExeSearchPaths = sync.OnceValue(func() []string { ... }) + var Hostname = sync.OnceValue(func() string { ... }) + var KittyExe = sync.OnceValue(func() string { ... }) + var RuntimeDir = sync.OnceValue(func() (runtime_dir string) { ... }) + var Sep = string(os.PathSeparator) + var UserMimeMap = sync.OnceValue(func() map[string]string { ... }) + func Abs[T constraints.Integer](x T) T + func Abspath(path string) string + func AtomicCreateSymlink(oldname, newname string) (err error) + func AtomicUpdateFile(path string, data io.Reader, perms ...fs.FileMode) (err error) + func AtomicWriteFile(path string, data io.Reader, perm os.FileMode) (err error) + func Capitalize(x string) string + func Commonpath(paths ...string) (longest_prefix string) + func Compile(pat string) (*regexp.Regexp, error) + func Concat[T any](slices ...[]T) []T + func ConfigDirForName(name string) (config_dir string) + func CreateAnonymousTemp(dir string, perms ...fs.FileMode) (*os.File, error) + func CurrentUser() (ans *user.User, err error) + func DownloadAsSlice(url string, progress_callback ReportFunc) (data []byte, err error) + func DownloadToFile(destpath, url string, progress_callback ReportFunc, ...) error + func DownloadToWriter(url string, dest io.Writer, progress_callback ReportFunc) error + func EncodeUtf8(ch UTF8State, dest []byte) int + func EscapeSHMetaCharacters(x string) string + func Expanduser(path string) string + func ExtractAllFromTar(tr *tar.Reader, dest_path string, optss ...TarExtractOptions) (count int, err error) + func Filter[T any](s []T, f func(x T) bool) []T + func FindExe(name string) string + func FunctionName(a any) string + func GuessMimeType(filename string) string + func GuessMimeTypeWithFileSystemAccess(filename string) string + func HumanRandomId(num_bits int64) (string, error) + func HumanUUID4() (string, error) + func ISO8601Format(x time.Time) string + func ISO8601Parse(raw string) (time.Time, error) + func IfElse[T any](condition bool, if_val T, else_val T) T + func Keys[M ~map[K]V, K comparable, V any](m M) []K + func LevenshteinDistance(s, t string, ignore_case bool) int + func LockFileExclusive(f *os.File) error + func LockFileShared(f *os.File) error + func LoginShellForCurrentUser() (ans string, err error) + func LoginShellForUser(u *user.User) (ans string, err error) + func LongestCommon(next func() (string, bool), prefix bool) string + func Map[T any, O any](f func(x T) O, s []T) []O + func Max[T constraints.Ordered](a T, items ...T) (ans T) + func Memset[T any](dest []T, pattern ...T) []T + func Min[T constraints.Ordered](a T, items ...T) (ans T) + func MonotonicRaw() (time.Time, error) + func MustCompile(pat string) *regexp.Regexp + func ParsePasswdDatabase(raw string) (ans map[string]PasswdEntry) + func ParsePasswdFile(path string) (ans map[string]PasswdEntry, err error) + func ParseSocketAddress(spec string) (network string, addr string, err error) + func Prefix(strs []string) string + func QuoteStringForFish(x string) string + func QuoteStringForSH(x string) string + func RandomFilename() string + func ReadAll(r io.Reader, expected_size int) ([]byte, error) + func ReadCompressedEmbeddedData(raw string) []byte + func ReaderForCompressedEmbeddedData(raw string) io.Reader + func RemoveAll[T comparable](s []T, q T) []T + func Remove[T comparable](s []T, q T) []T + func Repeat[T any](x T, n int) []T + func ReplaceAll(cpat *regexp.Regexp, str string, ...) string + func Repr(x any) string + func ResolveConfPath(path string) string + func Reverse[T any](s []T) []T + func Reversed[T any](s []T) []T + func RuneOffsetsToByteOffsets(text string) func(int) int + func Samefile(a, b any) bool + func Select(nfd int, r *unix.FdSet, w *unix.FdSet, e *unix.FdSet, timeout time.Duration) (n int, err error) + func SetStructDefaults(v reflect.Value) (err error) + func ShiftLeft[T any](s []T, amt int) []T + func SortWithKey[T any, C constraints.Ordered](s []T, key func(a T) C) []T + func Sort[T any](s []T, cmp func(a, b T) int) []T + func SourceLine(skip_frames ...int) int + func SourceLoc(skip_frames ...int) string + func Splitlines(x string, expected_number_of_lines ...int) (ans []string) + func StableSortWithKey[T any, C constraints.Ordered](s []T, key func(a T) C) []T + func StableSort[T any](s []T, cmp func(a, b T) int) []T + func Suffix(strs []string) string + func UnlockFile(f *os.File) error + func UnsafeBytesToString(b []byte) (s string) + func UnsafeStringToBytes(s string) (b []byte) + func Values[M ~map[K]V, K comparable, V any](m M) []V + func WalkWithSymlink(dirpath string, callback Walk_callback, transformers ...func(string) string) error + func Which(cmd string, paths ...string) string + type CachedValues struct + Name string + Opts T + func NewCachedValues[T any](name string, initial_val T) *CachedValues[T] + func (self *CachedValues[T]) Load() T + func (self *CachedValues[T]) Path() string + func (self *CachedValues[T]) Save() + type EncryptedRemoteControlCmd struct + EncProto string + Encrypted string + IV string + Pubkey string + Tag string + Version [3]int + type LRUCache struct + func NewLRUCache[K comparable, V any](max_size int) *LRUCache[K, V] + func (self *LRUCache[K, V]) Get(key K) (ans V, found bool) + func (self *LRUCache[K, V]) GetOrCreate(key K, create func(key K) (V, error)) (V, error) + func (self *LRUCache[K, V]) MustGetOrCreate(key K, create func(key K) V) V + func (self *LRUCache[K, V]) Set(key K, val V) + type PasswdEntry struct + Gecos string + Gid string + Home string + Pass string + Shell string + Uid string + Username string + func ParsePasswdLine(line string) (PasswdEntry, error) + func PwdEntryForUid(uid string) (ans PasswdEntry, err error) + type RemoteControlCmd struct + Async string + CancelAsync bool + Cmd string + KittyWindowId uint + NoResponse bool + Password string + Payload any + Stream bool + StreamId string + Timestamp int64 + Version [3]int + type ReportFunc = func(done, total uint64) error + type RingBuffer struct + func NewRingBuffer[T any](size uint64) *RingBuffer[T] + func (self *RingBuffer[T]) Capacity() uint64 + func (self *RingBuffer[T]) Clear() + func (self *RingBuffer[T]) Grow(new_size uint64) + func (self *RingBuffer[T]) Len() uint64 + func (self *RingBuffer[T]) ReadAll() []T + func (self *RingBuffer[T]) ReadTillEmpty(p []T) uint64 + func (self *RingBuffer[T]) WriteAllAndDiscardOld(p ...T) + func (self *RingBuffer[T]) WriteTillFull(p ...T) uint64 + type ScanLines struct + func NewScanLines(entries ...string) *ScanLines + func (self *ScanLines) Scan() bool + func (self *ScanLines) Text() string + type Selector struct + func CreateSelect(expected_number_of_fds int) *Selector + func (self *Selector) IsErrored(fd int) bool + func (self *Selector) IsReadyToRead(fd int) bool + func (self *Selector) IsReadyToWrite(fd int) bool + func (self *Selector) RegisterError(fd int) + func (self *Selector) RegisterRead(fd int) + func (self *Selector) RegisterWrite(fd int) + func (self *Selector) UnRegisterError(fd int) + func (self *Selector) UnRegisterRead(fd int) + func (self *Selector) UnRegisterWrite(fd int) + func (self *Selector) UnregisterAll() + func (self *Selector) Wait(timeout time.Duration) (num_ready int, err error) + func (self *Selector) WaitForever() (num_ready int, err error) + type Set struct + func NewSetWithItems[T comparable](items ...T) (ans *Set[T]) + func NewSet[T comparable](capacity ...int) (ans *Set[T]) + func (self *Set[T]) Add(val T) + func (self *Set[T]) AddItems(val ...T) + func (self *Set[T]) AsSlice() []T + func (self *Set[T]) Clear() + func (self *Set[T]) Discard(val T) + func (self *Set[T]) Equal(other *Set[T]) bool + func (self *Set[T]) ForEach(f func(T)) + func (self *Set[T]) Has(val T) bool + func (self *Set[T]) Intersect(other *Set[T]) (ans *Set[T]) + func (self *Set[T]) IsSubsetOf(other *Set[T]) bool + func (self *Set[T]) Iterable() map[T]struct{} + func (self *Set[T]) Len() int + func (self *Set[T]) Remove(val T) + func (self *Set[T]) String() string + func (self *Set[T]) Subtract(other *Set[T]) (ans *Set[T]) + type ShortUUID struct + var HumanUUID *ShortUUID + func CreateShortUUID(alphabet string) *ShortUUID + func (self *ShortUUID) Random(num_bits int64) (string, error) + func (self *ShortUUID) Uuid4() (string, error) + type StreamDecompressor = func(chunk []byte, is_last bool) error + func NewStreamDecompressor(constructor func(io.Reader) (io.ReadCloser, error), output io.Writer) StreamDecompressor + type StringScanner struct + PostProcessTokenFunc StringScannerPostprocessFunc + ScanFunc StringScannerScanFunc + func NewLineScanner(text string) *StringScanner + func NewSeparatorScanner(text, separator string) *StringScanner + func (self *StringScanner) Err() error + func (self *StringScanner) Scan() bool + func (self *StringScanner) Split(data string, expected_number ...int) (ans []string) + func (self *StringScanner) Text() string + type StringScannerPostprocessFunc = func(token string) string + type StringScannerScanFunc = func(data string) (remaining_data, token string) + func ScanFuncForSeparator(sep string) StringScannerScanFunc + type SubMatch struct + End int + Start int + Text string + type TarExtractOptions struct + DontPreservePermissions bool + type UTF8State uint32 + const UTF8_ACCEPT + const UTF8_REJECT + func DecodeUtf8(state *UTF8State, codep *UTF8State, byte_ byte) UTF8State + type Walk_callback func(path, abspath string, d fs.DirEntry, err error) error