shells

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCommandNotSimple = errors.New("")

Functions

func BashRemoveCompletions

func BashRemoveCompletions(appBase string, reader io.Reader) (completions []string, err error)

func ParseSimpleCommand

func ParseSimpleCommand(cmd string) (env, args []string, err error)

func Quote

func Quote(args []string) string

Types

type Bash

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

func (*Bash) GenerateCompletions

func (b *Bash) GenerateCompletions(executablePath string, _ []datastore.Completion) (lines []string)

func (*Bash) GetPreamble

func (b *Bash) GetPreamble() (lines []string)

func (*Bash) ResetCommand

func (b *Bash) ResetCommand(executablePath string) (lines []string)

type Fish

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

func (*Fish) GenerateCompletions

func (f *Fish) GenerateCompletions(executablePath string, _ []datastore.Completion) (shellScript []string)

func (*Fish) GetPreamble

func (f *Fish) GetPreamble() (lines []string)

func (*Fish) ResetCommand

func (f *Fish) ResetCommand(executablePath string) (shellScript []string)

type ShellScriptGenerator

type ShellScriptGenerator interface {
	GetPreamble() []string
	GenerateCompletions(executableName string, completions []datastore.Completion) []string
	ResetCommand(executablePath string) []string
}

func NewShellScriptGenerator

func NewShellScriptGenerator(shell string, codBinary string) (ShellScriptGenerator, error)

type Token

type Token struct {
	Decoded  string
	Original string

	// Position of the token in the original string
	OrigBegin int
	OrigEnd   int

	// Indicator of reserved word (e.g. `for`, `while`, `case` etc).
	// NB. Control operators such as `&&` are not reserved word
	IsReserved bool

	// Indicator of broken token
	IsBroken bool

	// Indicator of scary token (e.g. '`').
	// Commands with scary token are to complex for cod to reason about.
	IsScary bool
}

func Tokenize

func Tokenize(command string) (toks []Token, err error)

type Zsh

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

func (*Zsh) GenerateCompletions

func (z *Zsh) GenerateCompletions(executablePath string, _ []datastore.Completion) (script []string)

func (*Zsh) GetPreamble

func (z *Zsh) GetPreamble() (script []string)

func (*Zsh) ResetCommand

func (z *Zsh) ResetCommand(executablePath string) (script []string)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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