cmdutil

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2026 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompleteChoices

func CompleteChoices(choices ...string) cobra.CompletionFunc

func ContractHome

func ContractHome(path string) string

ContractHome makes a path nicer and shorter by contracting $HOME to '~'. If the path looks like a placeholder (starts with '('), it returns "-".

TODO: Make it fully correct, strings module is not path-aware.

func EmptyDash

func EmptyDash(s string) string

EmptyDash returns "-" if the string is empty; otherwise returns the string.

func EscapeYAMLScalar

func EscapeYAMLScalar(s string) string

EscapeYAMLScalar returns a YAML scalar which unmarshals to the given string. The intended use case is to escape user-provided data when pretty-printing YAML using a tabwriter. In the typical case it returns `s` unmodified. The result should be escaped with \xff before passing to a tabwriter. See https://pkg.go.dev/text/tabwriter#pkg-constants.

Types

type ColorMixin

type ColorMixin struct {
	Color string
	UnicodeMixin
}

func (ColorMixin) GetEscapes

func (mx ColorMixin) GetEscapes() *Escapes

type Escapes

type Escapes struct {
	Green        string
	BrightYellow string
	Bold         string
	End          string

	Tick, Dash, Ellipsis, UpArrow, Star string
	// contains filtered or unexported fields
}
func (e *Escapes) MakeLink(text string, url *url.URL, fallback string) string

type UnicodeMixin

type UnicodeMixin struct {
	Unicode string
}

func (UnicodeMixin) GetEscapes

func (ux UnicodeMixin) GetEscapes() *Escapes

Jump to

Keyboard shortcuts

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