shell

package
v2.9.4 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CacheAll

func CacheAll(_, _ string) bool

CacheAll is a CacheFunc that always returns true (always use cached results).

func CacheNone

func CacheNone(_, _ string) bool

CacheNone is a CacheFunc that always returns false (never cache anything).

func Fatal

func Fatal(args ...any)

func RegisterCompletionFunc

func RegisterCompletionFunc(cmd *cobra.Command, completionFunc CompletionFunc)

RegisterCompletionFunc registers a completion function for a command. NOTE: RegisterCompletionFunc must be called before cmd is passed to functions that make copies of it (such as cmdutil.CreateAlias. This is because RegisterCompletionFunc modifies cmd in a superficial way by adding an annotation (to the Annotations field) that associates it with the completion function. This means that

func Run

func Run(rootCmd *cobra.Command, maxCompletions int64)

Run runs a prompt, it does not return.

Types

type CacheFunc

type CacheFunc func(flag, text string) bool

CacheFunc is a function which returns whether or not cached results from a previous call to a CompletionFunc can be reused.

func AndCacheFunc

func AndCacheFunc(fs ...CacheFunc) CacheFunc

AndCacheFunc ands 0 or more cache funcs together.

func BranchCompletion

func BranchCompletion(flag, text string, maxCompletions int64) ([]prompt.Suggest, CacheFunc)

BranchCompletion completes branch parameters of the form <repo>@<branch>

func FileCompletion

func FileCompletion(flag, text string, maxCompletions int64) ([]prompt.Suggest, CacheFunc)

FileCompletion completes file parameters of the form <repo>@<branch>:/file

func FilesystemCompletion

func FilesystemCompletion(_, text string, maxCompletions int64) ([]prompt.Suggest, CacheFunc)

FilesystemCompletion completes file parameters from the local filesystem (not from pfs).

func JobCompletion

func JobCompletion(_, text string, maxCompletions int64) ([]prompt.Suggest, CacheFunc)

JobCompletion completes job parameters of the form <job>

func JobSetCompletion

func JobSetCompletion(_, text string, maxCompletions int64) ([]prompt.Suggest, CacheFunc)

JobCompletion completes job parameters of the form <job-set>

func PipelineCompletion

func PipelineCompletion(_, _ string, maxCompletions int64) ([]prompt.Suggest, CacheFunc)

PipelineCompletion completes pipeline parameters of the form <pipeline>

func ProjectBranchCompletion

func ProjectBranchCompletion(project, flag, text string, maxCompletions int64) ([]prompt.Suggest, CacheFunc)

ProjectBranchCompletion completes branch parameters of the form <repo>@<branch> in a project-aware fashion.

func ProjectCompletion

func ProjectCompletion(flag, text string, maxCompletions int64) ([]prompt.Suggest, CacheFunc)

func ProjectFileCompletion

func ProjectFileCompletion(project, flag, text string, maxCompletions int64) ([]prompt.Suggest, CacheFunc)

ProjectFileCompletion completes file parameters of the form <repo>@<branch>:/file in a project-aware manner.

func RepoCompletion

func RepoCompletion(_, text string, maxCompletions int64) ([]prompt.Suggest, CacheFunc)

RepoCompletion completes repo parameters of the form <repo>

func SameFlag

func SameFlag(flag string) CacheFunc

SameFlag is a CacheFunc that returns true if the flags are the same.

type CompletionFunc

type CompletionFunc func(flag, text string, maxCompletions int64) ([]prompt.Suggest, CacheFunc)

CompletionFunc is a function which returns completions for a command.

Jump to

Keyboard shortcuts

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