common

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecuteWithArgs

func ExecuteWithArgs(cmd *cobra.Command, args ...string) (out []byte, err error)

ExecuteWithArgs allows to test commands properly and individually Great reference: https://gianarb.it/blog/golang-mockmania-cli-command-with-cobra

func FormatFloat64

func FormatFloat64(f float64) string

func LookupFlagBool

func LookupFlagBool(cmd *cobra.Command, flagName string) (bool, error)

func LookupFlagInt

func LookupFlagInt(cmd *cobra.Command, flagName string) (int, error)

func NewRateLimiter

func NewRateLimiter(every time.Duration, calls int) *rate.Limiter

func OptionalInt

func OptionalInt(i ...int) *int

func OptionalIntWithDefault

func OptionalIntWithDefault(def int, i ...int) int

func OptionalString

func OptionalString(i ...string) *string

func OptionalStringWithDefault

func OptionalStringWithDefault(def string, i ...string) string

func Printf

func Printf(cmd *cobra.Command, format string, a ...interface{}) error

func Println

func Println(cmd *cobra.Command, a ...interface{}) error

func Readdir

func Readdir(dirPath string) ([]string, error)

func ToLowerCaseAll

func ToLowerCaseAll(ss []string) []string

func WrapErr

func WrapErr(err error) func(interface{}) error

WrapErr returns a wrapper function for the provided error the returned function may take any argument as exra information in order to specify the error more concretely

Types

type Error

type Error string

func (Error) Error

func (e Error) Error() string

Jump to

Keyboard shortcuts

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