Documentation
¶
Index ¶
- func AsUint16(val int) uint16
- func AtExit(fn func())
- func CompareVersions(v1, v2 string) int
- func Constrain(val int, min int, max int) int
- func Constrain32(val int32, min int32, max int32) int32
- func DurWithin(val time.Duration, min time.Duration, max time.Duration) time.Duration
- func IsTty(file *os.File) bool
- func IsWindows() bool
- func KillCommand(cmd *exec.Cmd) error
- func Max(first int, second int) int
- func Max16(first int16, second int16) int16
- func Max32(first int32, second int32) int32
- func Min(first int, second int) int
- func Min32(first int32, second int32) int32
- func Once(nextResponse bool) func() bool
- func Read(fd int, b []byte) (int, error)
- func RepeatToFill(str string, length int, limit int) string
- func RunAtExitFuncs()
- func RunOnce(f func()) func()
- func RunesWidth(runes []rune, prefixWidth int, tabstop int, limit int) (int, int)
- func SetNonblock(file *os.File, nonblock bool)
- func SetStdin(file *os.File)
- func StringWidth(s string) int
- func ToKebabCase(s string) string
- func Truncate(input string, limit int) ([]rune, int)
- type AtomicBool
- type Chars
- func (chars *Chars) Bytes() []byte
- func (chars *Chars) CopyRunes(dest []rune, from int)
- func (chars *Chars) Get(i int) rune
- func (chars *Chars) IsBytes() bool
- func (chars *Chars) LeadingWhitespaces() int
- func (chars *Chars) Length() int
- func (chars *Chars) Lines(multiLine bool, maxLines int, wrapCols int, wrapSignWidth int, tabstop int) ([][]rune, bool)
- func (chars *Chars) NumLines(atMost int) (int, bool)
- func (chars *Chars) Prepend(prefix string)
- func (chars *Chars) SliceRight(last int)
- func (chars *Chars) String() string
- func (chars *Chars) ToRunes() []rune
- func (chars *Chars) ToString() string
- func (chars *Chars) TrailingWhitespaces() int
- func (chars *Chars) TrimLength() uint16
- func (chars *Chars) TrimSuffix(runes []rune)
- func (chars *Chars) TrimTrailingWhitespaces()
- type EventBox
- type EventType
- type Events
- type Executor
- type Slab
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AtExit ¶
func AtExit(fn func())
AtExit registers the function fn to be called on program termination. The functions will be called in reverse order they were registered.
func CompareVersions ¶
CompareVersions compares two version strings
func Constrain32 ¶
Constrain32 limits the given 32-bit integer with the upper and lower bounds
func KillCommand ¶
KillCommand kills the process for the given command
func RepeatToFill ¶
RepeatToFill repeats the given string to fill the given width
func RunAtExitFuncs ¶
func RunAtExitFuncs()
RunAtExitFuncs runs any functions registered with AtExit().
func RunesWidth ¶
RunesWidth returns runes width
func SetNonblock ¶
SetNonblock executes syscall.SetNonblock on file descriptor
func StringWidth ¶
StringWidth returns string width where each CR/LF character takes 1 column
func ToKebabCase ¶
ToKebabCase converts the given CamelCase string to kebab-case
Types ¶
type AtomicBool ¶
type AtomicBool struct {
// contains filtered or unexported fields
}
AtomicBool is a boxed-class that provides synchronized access to the underlying boolean value
func NewAtomicBool ¶
func NewAtomicBool(initialState bool) *AtomicBool
NewAtomicBool returns a new AtomicBool
func (*AtomicBool) Get ¶
func (a *AtomicBool) Get() bool
Get returns the current boolean value synchronously
func (*AtomicBool) Set ¶
func (a *AtomicBool) Set(newState bool) bool
Set updates the boolean value synchronously
type Chars ¶
type Chars struct { // XXX Piggybacking item index here is a horrible idea. But I'm trying to // minimize the memory footprint by not wasting padded spaces. Index int32 // contains filtered or unexported fields }
func RunesToChars ¶
func (*Chars) LeadingWhitespaces ¶
func (*Chars) SliceRight ¶ added in v0.60.0
func (*Chars) TrailingWhitespaces ¶
func (*Chars) TrimLength ¶
TrimLength returns the length after trimming leading and trailing whitespaces
func (*Chars) TrimSuffix ¶ added in v0.60.0
func (*Chars) TrimTrailingWhitespaces ¶
func (chars *Chars) TrimTrailingWhitespaces()
type EventBox ¶
type EventBox struct {
// contains filtered or unexported fields
}
EventBox is used for coordinating events
type Events ¶
type Events map[EventType]interface{}
Events is a type that associates EventType to any data
type Executor ¶
type Executor struct {
// contains filtered or unexported fields
}
func NewExecutor ¶
func (*Executor) ExecCommand ¶
ExecCommand executes the given command with $SHELL