bash

package
v1.5.0 Latest Latest
Warning

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

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

Documentation

Overview

Package bash provides bash completion

Index

Constants

View Source
const (
	COMP_TYPE_NORMAL               = "9"  // TAB, for normal completion
	COMP_TYPE_LIST_PARTIAL_WORD    = "33" // ‘!’, for listing alternatives on partial word completion,
	COMP_TYPE_MENU_COMPLETION      = "37" // ‘%’, for menu completion
	COMP_TYPE_LIST_SUCCESSIVE_TABS = "63" // ‘?’, for listing completions after successive tabs,
	COMP_TYPE_LIST_NOT_UNMODIFIED  = "64" // ‘@’, to list completions if the word is not unmodified
)

Variables

This section is empty.

Functions

func ActionRawValues

func ActionRawValues(currentWord string, meta common.Meta, values common.RawValues) string

ActionRawValues formats values for bash.

func CompLine

func CompLine() (string, bool)

func Patch

func Patch(args []string) ([]string, error)

Patch patches args if `COMP_LINE` environment variable is set.

Bash passes redirects to the completion function so these need to be filtered out.

`example action >/tmp/stdout.txt --values 2>/tmp/stderr.txt fi[TAB]`
["example", "action", ">", "/tmp/stdout.txt", "--values", "2", ">", "/tmp/stderr.txt", "fi"]
["example", "action", "--values", "fi"]

func Snippet

func Snippet(cmd *cobra.Command) string

Snippet creates the bash completion script.

Types

type RedirectError

type RedirectError struct{}

RedirectError current position is a redirect like `echo test >[TAB]`.

func (RedirectError) Error

func (r RedirectError) Error() string

Jump to

Keyboard shortcuts

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