utils

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2025 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RedBg = lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("#FF0000"))
)

Functions

func BuildFilterQuery

func BuildFilterQuery(input string) string

func ComputeDisksArray

func ComputeDisksArray(disks string, numDisks int) ([]string, error)

func ComputeIPsArray

func ComputeIPsArray(ips string, numIPs int) ([]string, error)

func ComputeMountPointsArray

func ComputeMountPointsArray(mountPoints string, numDisks int) ([]string, error)

func ComputeNamesArray

func ComputeNamesArray(names string, numNodes int) []string

func ComputePortsArray

func ComputePortsArray(ports string, numPorts int) ([]int, error)

func Contains

func Contains[T comparable](s []T, e T) bool

func Count

func Count[T any](slice []T, findFn func(cmp T) bool) int

func CreateTar

func CreateTar(output string, src string) error

func ExtractTar

func ExtractTar(r io.Reader, dest string) error

func Find

func Find[T any](slice []T, findFn func(cmp T) bool) (T, bool)

func GenerateKeyPair

func GenerateKeyPair() (ed25519.PublicKey, ed25519.PrivateKey, error)

GenerateKeyPair generates an ed25519 keypair

func GenerateKeyPairFromSeed

func GenerateKeyPairFromSeed(seed []byte) (ed25519.PublicKey, ed25519.PrivateKey, error)

GenerateKeyPairFromSeed generates an ed25519 keypair

func GenerateSecret

func GenerateSecret() (string, error)

func IsHumanMode

func IsHumanMode() bool

func IsQuietMode

func IsQuietMode() bool

func IsValidFilter

func IsValidFilter(input string) bool

func IsValidIP

func IsValidIP(ip string) bool

func PEMDecodeKeyPair

func PEMDecodeKeyPair(pub []byte, priv []byte) (ed25519.PublicKey, ed25519.PrivateKey, error)

PEMDecodeKeyPair decodes an ed25519 PEM keypair encoded with PKIX and PKCS8 standards

func PEMDecodePrivateKey

func PEMDecodePrivateKey(priv []byte) (ed25519.PrivateKey, error)

PEMDecodePrivateKey decodes an ed25519 PEM encoded with PKCS8 standard

func PEMDecodePublicKey

func PEMDecodePublicKey(pub []byte) (ed25519.PublicKey, error)

PEMDecodePublicKey decodes an ed25519 PEM encoded with PKIX standard

func PEMEncodeKeyPair

func PEMEncodeKeyPair(pubKey ed25519.PublicKey, privKey ed25519.PrivateKey) (pub []byte, priv []byte, err error)

PEMEncodeKeyPair encodes an ed25519 keypair using the common PKIX and PKCS8 standards with a PEM format

func PEMEncodePrivateKey

func PEMEncodePrivateKey(privKey ed25519.PrivateKey) (priv []byte, err error)

PEMEncodePrivateKey encodes an ed25519 private key using the common PKCS8 standard with a PEM format

func PEMEncodePublicKey

func PEMEncodePublicKey(pubKey ed25519.PublicKey) (pub []byte, err error)

PEMEncodePublicKey encodes an ed25519 public key using the common PKIX standard with a PEM format

func PrintCreateSuccess

func PrintCreateSuccess(resourceType, id string)

func PrintDelete

func PrintDelete(s string)

func PrintEmptyLine

func PrintEmptyLine()

func PrintEmptyList

func PrintEmptyList()

func PrintError

func PrintError(err error)

func PrintFormattedData

func PrintFormattedData(data interface{}, format string)

func PrintHint

func PrintHint(s string)

func PrintInfo

func PrintInfo(s string)

func PrintList

func PrintList(s string)

func PrintNotFound

func PrintNotFound(s string)

func PrintQuiet

func PrintQuiet(fields ...string)

func PrintSimpleList

func PrintSimpleList(items []string)

func PrintSmartOutput

func PrintSmartOutput[T any](
	cmd *cobra.Command,
	items []T,
	fieldsFunc func(T) []string,
	config *SmartOutputConfig[T],
) error

func PrintSuccess

func PrintSuccess(s string)

func PrintVerbose

func PrintVerbose(data interface{}, noHeaders bool)

func PrintWarn

func PrintWarn(s string)

func SetOutputMode

func SetOutputMode(mode OutputMode)

func StringOrEmpty

func StringOrEmpty(v *string) string

func TimeOrEmpty

func TimeOrEmpty(v *time.Time) string

func ValidateIPsInput

func ValidateIPsInput(ips string, numNodes int) error

func ValidateNamesInput

func ValidateNamesInput(names string, numNodes int) error

func WriteFile

func WriteFile(filename string, data []byte) error

Types

type OutputMode

type OutputMode int
const (
	OutputQuiet OutputMode = iota
	OutputHuman
)

type QueryOperator

type QueryOperator string

type SmartOutputConfig

type SmartOutputConfig[T any] struct {
	SingleResource              bool
	SingleResourceCompactOutput bool
	DefaultOutput               configuration.OutputFormat
}

Jump to

Keyboard shortcuts

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