utils

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Assert

func Assert(ok bool, args ...any)

func ForeachSlice

func ForeachSlice[T any](slice []T, f func(T))

func Keys

func Keys[K comparable, V any](m map[K]V) []K

func MapSlice

func MapSlice[T1, T2 any](slice []T1, f func(T1) T2) []T2

func TrimWhitespacesAndCount

func TrimWhitespacesAndCount(text string) (string, int)

func UpdateHelpFlag added in v0.2.0

func UpdateHelpFlag(cmd *cobra.Command)

func WalkCmd added in v0.2.0

func WalkCmd(cmd *cobra.Command, f func(*cobra.Command))

func Wrap

func Wrap(text string, limit int) string

Types

type Stack

type Stack[T any] struct {
	// contains filtered or unexported fields
}

func (*Stack[T]) Empty

func (s *Stack[T]) Empty() bool

func (*Stack[T]) Pop

func (s *Stack[T]) Pop() T

func (*Stack[T]) Push

func (s *Stack[T]) Push(a T)

func (*Stack[T]) Size

func (s *Stack[T]) Size() int

func (*Stack[T]) String

func (s *Stack[T]) String() string

func (*Stack[T]) Top

func (s *Stack[T]) Top() T

Jump to

Keyboard shortcuts

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