helper

package
v1.17.3 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAPIRequestParametersFromFlags

func GetAPIRequestParametersFromFlags(cmd *cobra.Command, opts ...APIRequestParametersFromFlagsOption) (connection.APIRequestParameters, error)

GetAPIRequestParametersFromFlags returns an APIRequestParameters populated from global flags

func GetBoolPtrFlagIfChanged

func GetBoolPtrFlagIfChanged(cmd *cobra.Command, name string) *bool

func GetContentsFromFilePathFlag

func GetContentsFromFilePathFlag(cmd *cobra.Command, fs afero.Fs, filePathFlag string) (string, error)

func GetContentsFromLiteralOrFilePathFlag

func GetContentsFromLiteralOrFilePathFlag(cmd *cobra.Command, fs afero.Fs, literalFlag, filePathFlag string) (string, error)

func GetDestinationFilePath

func GetDestinationFilePath(fs afero.Fs, source string, destination string) (string, error)

GetDestinationFilePath returns the destination path, given source file 'source' and optional destination path 'destination'

func GetFilteringArrayFromStringArrayFlagValue

func GetFilteringArrayFromStringArrayFlagValue(filters []string) ([]connection.APIRequestFiltering, error)

GetFilteringArrayFromStringArrayFlagValue retrieves an array of APIRequestFiltering structs for given filtering strings

func GetFilteringFromStringFlagValue

func GetFilteringFromStringFlagValue(filter string) (connection.APIRequestFiltering, error)

GetFilteringFromStringFlagValue retrieves a APIRequestFiltering struct from given filtering string. This function expects a string in the following format (with optional :operator): propertyname:operator=value, Valid examples: name:eq=something name=something

func GetFilteringInferOperator

func GetFilteringInferOperator(property string, value string) connection.APIRequestFiltering

GetFilteringInferOperator returns an APIRequestFiltering struct with the operater inferred from the input value. This will return an operator based on the following rules: If value contains a comma ',' - returns IN operator If value contains an asterisk '*' - returns LK operator Otherwise returns EQ operator

func GetIntPtrFlagIfChanged

func GetIntPtrFlagIfChanged(cmd *cobra.Command, name string) *int

func GetSortingFromStringFlagValue

func GetSortingFromStringFlagValue(sort string) connection.APIRequestSorting

GetSortingFromStringFlagValue return an APIRequestSorting struct from given sorting string flag

func GetStringPtrFlagIfChanged

func GetStringPtrFlagIfChanged(cmd *cobra.Command, name string) *string

func InferTypeFromStringFlagValue

func InferTypeFromStringFlagValue(flag string) interface{}

InferTypeFromStringFlagValue will return a int, bool or string, based on value of flag

func JoinInt

func JoinInt(a []int, sep string) string

JoinInt joins an array of integers with given sep

func WaitForCommand

func WaitForCommand(f WaitFunc) error

Types

type APIRequestParametersFromFlagsOption

type APIRequestParametersFromFlagsOption interface {
	Hydrate(params *connection.APIRequestParameters, cmd *cobra.Command)
}

type StringFilterFlagOption

type StringFilterFlagOption struct {
	FlagName           string
	FilterPropertyName string
}

func NewStringFilterFlagOption

func NewStringFilterFlagOption(flagName string, filterPropertyName string) *StringFilterFlagOption

func (*StringFilterFlagOption) Hydrate

type WaitFunc

type WaitFunc func() (finished bool, err error)

Jump to

Keyboard shortcuts

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