common

package
v0.50.2 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package common code

Index

Constants

This section is empty.

Variables

View Source
var FromInvokedAction func(action interface{}) (Meta, RawValues)

FromInvokedAction provides access to RawValues within an InvokedAction. It is intended for testing purposes in Sandbox (circumventing dependency issues).

Functions

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

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 ByRune added in v0.26.0

type ByRune []rune

func (ByRune) Len added in v0.26.0

func (r ByRune) Len() int

func (ByRune) Less added in v0.26.0

func (r ByRune) Less(i, j int) bool

func (ByRune) Swap added in v0.26.0

func (r ByRune) 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 Group added in v0.29.0

type Group struct {
	Cmd *cobra.Command
}

func (Group) Style added in v0.29.0

func (g Group) Style() string

func (Group) Tag added in v0.29.0

func (g Group) Tag() string

type Messages added in v0.28.0

type Messages struct {
	// contains filtered or unexported fields
}

func (*Messages) Add added in v0.28.0

func (m *Messages) Add(s string)

func (Messages) Get added in v0.28.0

func (m Messages) Get() []string

func (Messages) Integrate added in v0.28.0

func (m Messages) Integrate(values RawValues, prefix string) RawValues

func (Messages) IsEmpty added in v0.28.0

func (m Messages) IsEmpty() bool

func (Messages) MarshalJSON added in v0.28.0

func (m Messages) MarshalJSON() ([]byte, error)

func (*Messages) Merge added in v0.28.0

func (m *Messages) Merge(other Messages)

func (*Messages) Suppress added in v0.28.0

func (m *Messages) Suppress(expr ...string) error

func (*Messages) UnmarshalJSON added in v0.28.0

func (m *Messages) UnmarshalJSON(data []byte) (err error)

type Meta added in v0.28.0

type Meta struct {
	Messages Messages      `json:"messages"`
	Nospace  SuffixMatcher `json:"nospace"`
	Usage    string        `json:"usage"`
}

func (*Meta) Merge added in v0.29.0

func (m *Meta) Merge(other Meta)

type Mock added in v0.30.0

type Mock struct {
	Dir     string
	Replies map[string]string
}

func NewMock added in v0.39.2

func NewMock(t t) *Mock

func (Mock) CacheDir added in v0.39.1

func (m Mock) CacheDir() string

func (Mock) WorkDir added in v0.39.1

func (m Mock) WorkDir() string

type RawValue added in v0.2.4

type RawValue struct {
	Value       string `json:"value"`
	Display     string `json:"display"`
	Description string `json:"description,omitempty"`
	Style       string `json:"style,omitempty"`
	Tag         string `json:"tag,omitempty"`
}

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) Decolor added in v0.36.2

func (r RawValues) Decolor() RawValues

Decolor clears style for all values.

func (RawValues) EachTag added in v0.29.0

func (r RawValues) EachTag(f func(tag string, values RawValues))

func (RawValues) Filter added in v0.28.0

func (r RawValues) Filter(values ...string) RawValues

Filter filters values.

func (RawValues) FilterPrefix added in v0.5.0

func (r RawValues) FilterPrefix(prefix string) RawValues

FilterPrefix filters values with given prefix.

func (RawValues) Retain added in v0.38.3

func (r RawValues) Retain(values ...string) RawValues

Retain retains given values.

func (RawValues) Unique added in v0.31.0

func (r RawValues) Unique() RawValues

type SuffixMatcher added in v0.26.0

type SuffixMatcher struct {
	// contains filtered or unexported fields
}

func (*SuffixMatcher) Add added in v0.26.0

func (sm *SuffixMatcher) Add(suffixes ...rune)

func (SuffixMatcher) MarshalJSON added in v0.28.1

func (sm SuffixMatcher) MarshalJSON() ([]byte, error)

func (SuffixMatcher) Matches added in v0.26.0

func (sm SuffixMatcher) Matches(s string) bool

func (*SuffixMatcher) Merge added in v0.28.1

func (sm *SuffixMatcher) Merge(other SuffixMatcher)

func (*SuffixMatcher) UnmarshalJSON added in v0.28.1

func (sm *SuffixMatcher) UnmarshalJSON(data []byte) (err error)

Jump to

Keyboard shortcuts

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