util

package
v1.38.2 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Byte     = 1
	Kibibyte = Byte * 1024
	Mebibyte = Kibibyte * 1024
	Gibibyte = Mebibyte * 1024
	Tebibyte = Gibibyte * 1024
)

Variables

This section is empty.

Functions

func Age added in v1.31.0

func Age(t, currentTime time.Time) string

func ChainRunE

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

func DatacenterToSchema

func DatacenterToSchema(datacenter hcloud.Datacenter) schema.Datacenter

func Datetime

func Datetime(t time.Time) string

func DeprecatableResourceToSchema added in v1.35.0

func DeprecatableResourceToSchema(deprecatableResource hcloud.DeprecatableResource) schema.DeprecatableResource

func DescribeDeprecation added in v1.35.0

func DescribeDeprecation(resource hcloud.Deprecatable) string

func DescribeFormat

func DescribeFormat(object interface{}, format string) error

func DescribeJSON

func DescribeJSON(object interface{}) error

func ExactlyOneSet

func ExactlyOneSet(s string, ss ...string) bool

func ISOToSchema

func ISOToSchema(iso hcloud.ISO) schema.ISO

func ImageToSchema

func ImageToSchema(image hcloud.Image) schema.Image

func LabelsToString

func LabelsToString(labels map[string]string) string

func ListLongDescription

func ListLongDescription(intro string, columns []string) string

func LoadBalancerTypeToSchema

func LoadBalancerTypeToSchema(loadBalancerType hcloud.LoadBalancerType) schema.LoadBalancerType

func LocationToSchema

func LocationToSchema(location hcloud.Location) schema.Location

func NA

func NA(s string) string

func PlacementGroupToSchema added in v1.31.0

func PlacementGroupToSchema(placementGroup hcloud.PlacementGroup) schema.PlacementGroup

func PrefixLines added in v1.35.0

func PrefixLines(text, prefix string) string

PrefixLines will prefix all individual lines in the text with the passed prefix.

func ServerTypeToSchema

func ServerTypeToSchema(serverType hcloud.ServerType) schema.ServerType

func SplitLabel

func SplitLabel(label string) []string

func SplitLabelVars added in v1.23.0

func SplitLabelVars(label string) (string, string)

SplitLabelVars splits up label into key and value and returns them as separate return values. If label doesn't contain the `=` separator, SplitLabelVars returns the original string as key, with an empty value.

func ValidateRequiredFlags added in v1.22.0

func ValidateRequiredFlags(flags *pflag.FlagSet, names ...string) error

ValidateRequiredFlags ensures that flags has values for all flags with the passed names.

This function duplicates the functionality cobra provides when calling MarkFlagRequired. However, in some cases a flag cannot be marked as required in cobra, for example when it depends on other flags. In those cases this function comes in handy.

func YesNo

func YesNo(b bool) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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