Documentation
¶
Index ¶
- Variables
- func ExecuteCommand(name string, args ...string) (string, error)
- func ExecuteCommandBare(name string, stdOut, stdErr io.Writer, args ...string) error
- func FileExists(path string) bool
- func IsCommandInstalled(name string) bool
- func Max[T constraints.Ordered](x, y T) T
- func Min[T constraints.Ordered](x, y T) T
- func ReadJson(file afero.File, v any) error
- func RemoveUTF8BOM(data []byte) []byte
- func WrapCobraCommandHandler(fun func(cmd *cobra.Command, args []string) error) func(cmd *cobra.Command, args []string)
- func WriteJson(file afero.File, v any) error
- type Comparable
- type ComparableNamed
- type ComparableNamedSlice
- func (slice ComparableNamedSlice[T]) Filter(test func(T) bool) (ret ComparableNamedSlice[T])
- func (slice ComparableNamedSlice[T]) Len() int
- func (slice ComparableNamedSlice[T]) Less(i, j int) bool
- func (slice ComparableNamedSlice[T]) Names() (ret []string)
- func (slice ComparableNamedSlice[T]) Swap(i, j int)
- type Named
- type StringSlice
Constants ¶
This section is empty.
Variables ¶
var NoBellStdout = &noBellStdout{}
NoBellStdout returns a stdout wrapper that doesn't ring the terminal bell https://github.com/manifoldco/promptui/issues/49 & https://github.com/manifoldco/promptui/issues/49#issuecomment-1012640880
Functions ¶
func ExecuteCommand ¶
ExecuteCommand executes a command and returns the output
func ExecuteCommandBare ¶
ExecuteCommandBare executes a command and writes the output to the given writers
func IsCommandInstalled ¶
IsCommandAvailable checks if a command is available
func RemoveUTF8BOM ¶
RemoveUTF8BOM removes the UTF8 BOM from the given byte array if present
Types ¶
type Comparable ¶
type Comparable interface {
Compare(Comparable) int
}
Comparable is an interface that can be used to compare two objects
type ComparableNamed ¶
type ComparableNamed interface { Comparable Named }
ComparableNamed is an interface that can be used to sort a slice of named objects
type ComparableNamedSlice ¶
type ComparableNamedSlice[T ComparableNamed] []T
NamedSortableSlice is an interface that can be used to sort a slice of named objects
func (ComparableNamedSlice[T]) Filter ¶
func (slice ComparableNamedSlice[T]) Filter(test func(T) bool) (ret ComparableNamedSlice[T])
Filter filters a slice of any type using a test function
func (ComparableNamedSlice[T]) Len ¶
func (slice ComparableNamedSlice[T]) Len() int
Implement the sort.Interface interface
func (ComparableNamedSlice[T]) Less ¶
func (slice ComparableNamedSlice[T]) Less(i, j int) bool
func (ComparableNamedSlice[T]) Names ¶
func (slice ComparableNamedSlice[T]) Names() (ret []string)
Names returns the names of the give slice of named objects
func (ComparableNamedSlice[T]) Swap ¶
func (slice ComparableNamedSlice[T]) Swap(i, j int)
type Named ¶
type Named interface {
Named() string
}
Named is an interface that can be used to get the name of an object
type StringSlice ¶
type StringSlice []string
StringSlice is a slice of strings, helper type used for extension methods
func (StringSlice) LongestLength ¶
func (slice StringSlice) LongestLength() int
LongestLength returns the length of the longest string in the given slice
func (StringSlice) ToLower ¶
func (slice StringSlice) ToLower() StringSlice
ToLower returns a copy of the given slice of strings with all strings lowercased