utils

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2025 License: MIT Imports: 20 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Version string = "dev"

Functions

func Blue

func Blue(value string) string

Blue converts a string to blue color in the console with bold text.

func BoolPointerToString

func BoolPointerToString(value *bool) string

func BuildURL

func BuildURL(basePath, relativePath string, params map[string]string) string

func CliError

func CliError(msg string, args ...interface{})

CliError handles all error messages in the CLI.

func CliInfo

func CliInfo(msg string, args ...interface{})

CliInfo handles all informational messages in the CLI.

func CliInfoWithExit

func CliInfoWithExit(msg string, args ...interface{})

CliInfoWithExit prints an informational message to stderr and exits the program with a status code of 0

func CliWarning

func CliWarning(msg string, args ...interface{})

CliWarning handles all warning messages in the CLI.

func CreateAndEditTempFile

func CreateAndEditTempFile(data []byte) (string, error)

func DeleteFile

func DeleteFile(path string) error

func GetCLIVersion

func GetCLIVersion() string

func GetUserAgent

func GetUserAgent() string

func Green

func Green(value string) string

Green converts a string to green color in the console with bold text.

func IsUUID

func IsUUID(str string) bool

func PrettyJSON

func PrettyJSON(data []byte) (*bytes.Buffer, error)

func PrintHeader

func PrintHeader(header string)

func PrintJson

func PrintJson(body []byte)

func PrintTable

func PrintTable(slice interface{})

func ProcessEditedData

func ProcessEditedData(originalData []byte) (interface{}, error)

ProcessEditedData facilitates user modifications to original data, formats it, supports editing via a temp file, compares the edited data against the original, and parses it into JSON. If no changes are made, the update is aborted and an error is returned.

func PromptForBool

func PromptForBool(prompt string) bool

func PromptForInput

func PromptForInput(promptText string) string

func PromptForIntInput

func PromptForIntInput(promptText string, defaultValue int) int

func PromptForListInput

func PromptForListInput(promptText string) []string

func PromptForPassword

func PromptForPassword(promptText string) string

func PromptForRequiredInput

func PromptForRequiredInput(promptText string) string

func PromptForRequiredIntInput

func PromptForRequiredIntInput(promptText string) int

func PromptForRequiredListInput

func PromptForRequiredListInput(promptText string) []string

func ReadFileFromPath

func ReadFileFromPath(filePath string) ([]byte, error)

func Red

func Red(value string) string

Red converts a string to red color in the console with bold text.

func RemovePrefixBeforeAPI

func RemovePrefixBeforeAPI(url string) string

func SaveFile

func SaveFile(fileName string, data []byte) error
func ShowLogo()

func SplitAndParseInt

func SplitAndParseInt(input string) []int

func SplitPath

func SplitPath(path string) (string, string)

func TimeFormat

func TimeFormat(value int) *string

func TimeUtils

func TimeUtils(t time.Time) string

func TruncateString

func TruncateString(str string, num int) string

func Unzip

func Unzip(src string, dest string) error

func Yellow

func Yellow(value string) string

Yellow converts a string to yellow color in the console with bold text.

func Zip

func Zip(folderPath string) ([]byte, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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