util

package
v0.0.0-...-652b38d Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AbortForCommand

func AbortForCommand(cmd *cobra.Command, cliError *model.CliError)

func AbortForCommandWithSubResource

func AbortForCommandWithSubResource(cmd *cobra.Command, cliError *model.CliError, subResource, operation string)

func AbortWithExitCode

func AbortWithExitCode(message string, code int)

func AbortWithUsageAndMessageAndCode

func AbortWithUsageAndMessageAndCode(cmd *cobra.Command, message string, code int)

func Bold

func Bold(a ...interface{}) string

func ByteArrayToStruct

func ByteArrayToStruct(cmd *cobra.Command, byt []byte, payloadObject interface{})

func CamelToTitle

func CamelToTitle(inp string) string

func CheckAndPrintJson

func CheckAndPrintJson(jsonOutput bool, data interface{})

print json output if flag is passed

func CheckIfBothJsonAndFlagAreSetForCommand

func CheckIfBothJsonAndFlagAreSetForCommand(cmd *cobra.Command, jsonData []byte, isStandardInputAvailable bool) bool

CheckIfBothJsonAndFlagAreSetForCommand method returns true if json input is set, otherwise false

func ClientProfileInCLIOutputFormat

func ClientProfileInCLIOutputFormat(clientProfile model.ClientProfile) string

func ContainsIgnoreCase

func ContainsIgnoreCase(a string, b string) bool

Check contains and irrespective of case.

func ContainsInArray

func ContainsInArray(array []string, inputString string) bool

Check contains and irrespective of case.

func ConvertBooleanToYesOrNo

func ConvertBooleanToYesOrNo(input bool) string

func FindSuggestions

func FindSuggestions(cmd *cobra.Command, arg string) string

FindSuggestions returns a list possible subcommands referenced cobra.command findSuggestions() library

func FormatTime

func FormatTime(inputTime string) string

func GetApiErrorMessagesForCommand

func GetApiErrorMessagesForCommand(cmd *cobra.Command, apiError model.ApiError, subResource, operation, responseCode string) []string

func GetApiSubErrorMessagesForCommand

func GetApiSubErrorMessagesForCommand(cmd *cobra.Command, apiSubError []model.ApiSubError, parentErrorKey, subResource, operation string) []string

Get All the error messages for api sub errors

func GetColourForEnum

func GetColourForEnum(enum string, bold bool) color.Color

func GetConvertedInteger

func GetConvertedInteger(number string) int

func GetEdgeGridErrorMessage

func GetEdgeGridErrorMessage(key string) string

Get edge grid errors for given key

func GetErrorMessageForFlag

func GetErrorMessageForFlag(cmd *cobra.Command, errorType, flagKeyInJson string) string

Get different type of message for flag

func GetErrorMessageForSubArgument

func GetErrorMessageForSubArgument(cmd *cobra.Command, errorType, subCommandKeyInJson string) string

GetErrorMessageForSubArgument different type of message for invalid argument

func GetGlobalErrorMessage

func GetGlobalErrorMessage(key string) string

Get global errors for given key

func GetHttpExitCode

func GetHttpExitCode(responseCode string) int

GetHttpExitCode get equivalent exit status code for corresponding http status code

func GetJsonKeyForFlag

func GetJsonKeyForFlag(flag string) string

func GetMessageForKey

func GetMessageForKey(baseCmdPath *cobra.Command, key string) string

Return message for given key under command.

func GetPlaceHoldersInString

func GetPlaceHoldersInString(errorMessage, regex string) []string

Get all placeholders in string inside {{}}

func GetResolvedOrUnResolvedCondition

func GetResolvedOrUnResolvedCondition(condition model.Condition) string

func GetResolvedOrUnResolvedHeaders

func GetResolvedOrUnResolvedHeaders(header model.RequestHeader) string

func GetResolvedOrUnResolvedRequestBody

func GetResolvedOrUnResolvedRequestBody(testRequest model.TestRequest) string

func GetResolvedOrUnResolvedRequestURL

func GetResolvedOrUnResolvedRequestURL(testRequest model.TestRequest) string

func GetServiceMessage

func GetServiceMessage(cmd *cobra.Command, messageType string, subresource string, jsonKey string) string

GetServiceMessage different type of service messages based on commands and messageType

func GetStatusKeyAndColour

func GetStatusKeyAndColour(status string) (string, color.Color)

func GetTotalTestCasesCount

func GetTotalTestCasesCount(testCases []model.TestCase) int

func Italic

func Italic(a ...interface{}) string

func LegacyArgs

func LegacyArgs(cmd *cobra.Command, args []string) error

LegacyArgs is used to invalidate unknown subcommands took reference from cobra.args legacyArgs() library

func NoArgsCheck

func NoArgsCheck(cmd *cobra.Command, args []string) error

NoArgsCheck returns an error if any args are included.

func PrintError

func PrintError(message string, args ...interface{})

PrintError Start Standard Print Functions

func PrintErrorMessages

func PrintErrorMessages(errorMessages []string)

func PrintHeader

func PrintHeader(message string, args ...interface{})

func PrintJsonAndExit

func PrintJsonAndExit(data interface{})

func PrintLabelAndValue

func PrintLabelAndValue(label string, value interface{})

func PrintLabelValueWithColour

func PrintLabelValueWithColour(label string, clr *color.Color, value interface{})

func PrintRawRequestResponseHeaders

func PrintRawRequestResponseHeaders(requestResponseHeaders []model.Header)

func PrintSuccess

func PrintSuccess(message string, args ...interface{})

func PrintSuccessInBold

func PrintSuccessInBold(message string, args ...interface{})

func PrintTemplate

func PrintTemplate(templateToParse string, data interface{})

func PrintTotalItems

func PrintTotalItems(count int)

func PrintWarning

func PrintWarning(message string, args ...interface{})

func PrintWarnings

func PrintWarnings(waringMessages []string)

func ReadStdin

func ReadStdin(cmd *cobra.Command) (bool, []byte)

func RequestHeaderInCLIOutputFormat

func RequestHeaderInCLIOutputFormat(headerName, headerAction, headerValue string) string

func SetVariablesInCLIOutputFormat

func SetVariablesInCLIOutputFormat(variable model.DynamicVariable) string

func ShowTable

func ShowTable(tableHeaders []string, tableContents [][]string, showTotal bool)

ShowTable Standard function to show table in same format across Test Center CLI

Types

type Spinner

type Spinner struct {
	// contains filtered or unexported fields
}

func NewSpinner

func NewSpinner(message string, enabled bool) Spinner

func (Spinner) Start

func (s Spinner) Start() Spinner

func (Spinner) StopWithFailure

func (s Spinner) StopWithFailure()

func (Spinner) StopWithSuccess

func (s Spinner) StopWithSuccess()

Jump to

Keyboard shortcuts

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