common

package
v0.20.1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package common code

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CaptureStdout added in v0.13.0

func CaptureStdout(f func() error) (string, error)

func IsDash added in v0.13.0

func IsDash(cmd *cobra.Command) bool

IsDash checks if command contains a dash disabling flag parsing

example action positional1 -- dash1 dash2

func IsShorthandOnly

func IsShorthandOnly(flag *pflag.Flag) (b bool)

IsShorthandOnly uses reflection to check for pflag.Flag.Shorthandonly to support both spf13/pflag and cornfeedhobos shorthand change (needed for carapace-bin) won't be necessary if https://github.com/spf13/pflag/pull/256 should ever be merged

func TraverseLenient added in v0.3.10

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

TraverseLenient traverses the command tree but filters errors regarding arguments currently being completed

Types

type ByDisplay added in v0.4.2

type ByDisplay []RawValue

ByDisplay alias to filter by display

func (ByDisplay) Len added in v0.4.2

func (a ByDisplay) Len() int

func (ByDisplay) Less added in v0.4.2

func (a ByDisplay) Less(i, j int) bool

func (ByDisplay) Swap added in v0.4.2

func (a ByDisplay) Swap(i, j int)

type ByValue added in v0.3.0

type ByValue []RawValue

ByValue alias to filter by value

func (ByValue) Len added in v0.3.0

func (a ByValue) Len() int

func (ByValue) Less added in v0.3.0

func (a ByValue) Less(i, j int) bool

func (ByValue) Swap added in v0.3.0

func (a ByValue) Swap(i, j int)

type RawValue added in v0.2.4

type RawValue struct {
	Value       string
	Display     string
	Description string
	Style       string
}

RawValue represents a completion candidate

func (RawValue) TrimmedDescription added in v0.5.8

func (r RawValue) TrimmedDescription() string

TrimmedDescription returns the trimmed description

type RawValues added in v0.5.0

type RawValues []RawValue

RawValues is an alias for []RawValue

func RawValuesFrom added in v0.2.4

func RawValuesFrom(values ...string) RawValues

RawValuesFrom creates RawValues from given values

func (RawValues) FilterPrefix added in v0.5.0

func (r RawValues) FilterPrefix(prefix string) RawValues

FilterPrefix filters values with given prefix

Jump to

Keyboard shortcuts

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