utils

package
v1.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 30, 2026 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

View Source
const ESCAPE_RUNE = '\\'
View Source
const SEMVER = `^([a-zA-Z.]*?)?(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:-([0-9A-Za-z.-]+))?$`

Variables

This section is empty.

Functions

func Center

func Center(item any, width int) string

func Digits

func Digits(n int) int

func FindJson

func FindJson[T any](path string, raw map[string]any, item *T) error

func FormatMilliseconds

func FormatMilliseconds(timestamp int64) string

func FormatMillisecondsCompact

func FormatMillisecondsCompact(timestamp int64) string

func Left

func Left(item any, width int) string

func Max

func Max(a, b int) int

func Min

func Min(a, b int) int
func Right(item any, width int) string

func SplitByRune

func SplitByRune(s string, sep rune) []string

func SplitCommand

func SplitCommand(input string) ([]string, error)

Types

type Argument

type Argument struct {
	// contains filtered or unexported fields
}

func ArgumentFrom

func ArgumentFrom(item string) *Argument

func (Argument) Bool

func (a Argument) Bool() (bool, bool)

func (Argument) Boold

func (a Argument) Boold(def bool) bool

func (Argument) Float32

func (a Argument) Float32() (float32, bool)

func (Argument) Float32d

func (a Argument) Float32d(def float32) float32

func (Argument) Float64

func (a Argument) Float64() (float64, bool)

func (Argument) Float64d

func (a Argument) Float64d(def float64) float64

func (Argument) Int

func (a Argument) Int() (int, bool)

func (Argument) Int64

func (a Argument) Int64() (int64, bool)

func (Argument) Int64d

func (a Argument) Int64d(def int64) int64

func (Argument) Intd

func (a Argument) Intd(def int) int

func (Argument) String

func (a Argument) String() string

type CmdTuple

type CmdTuple struct {
	Flag string
	Data string
}

func NewCmdTuple

func NewCmdTuple(flag, data string) *CmdTuple

type Table

type Table struct {
	// contains filtered or unexported fields
}

func NewTable

func NewTable() *Table

func (*Table) Field

func (t *Table) Field(header string, row int, data any) *Table

func (*Table) Headers

func (t *Table) Headers(headers ...string) *Table

func (*Table) ToString

func (t *Table) ToString() string

type Version

type Version struct {
	Prefix     string
	Major      int
	Minor      int
	Patch      int
	PreRelease string
}

func ParseVersion

func ParseVersion(v string) (*Version, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL