environments

package
v1.0.20210616 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultCommands []Command

default commands are valid in all environments

View Source
var Environments = map[Environment]*Runtime{}
View Source
var Registers = map[Environment]Register{}

Functions

func AllMatch

func AllMatch(text string, cmd string) bool

func BuildPromptKeyBinds

func BuildPromptKeyBinds() []prompt.KeyBind

func ExecuteAndGetResult

func ExecuteAndGetResult(program string, args string) (int, string)

func Executor

func Executor(program string, args string)

func GetActiveCompleter

func GetActiveCompleter() prompt.Completer

Return active completer

func GetActiveExecutor

func GetActiveExecutor() prompt.Executor

Return active executor

func GetDefaultExecutor

func GetDefaultExecutor(env string, callback func()) prompt.Executor

func GetPathSuggestion

func GetPathSuggestion(path string) []prompt.Suggest

func HelpInfo

func HelpInfo(args []string, out io.Writer)

print help information

func IgnoreCaseMatch

func IgnoreCaseMatch(text string, cmd string) bool

func Initialize

func Initialize()

Check and initialize environments

func LivePrefix

func LivePrefix() (prefix string, useLivePrefix bool)
func Logo(args []string, out io.Writer)

func SelectCurrentEnvironment

func SelectCurrentEnvironment()

Select one of installed environment

func StartWithMatch

func StartWithMatch(text string, cmd string) bool

Types

type Command

type Command struct {
	Text         string
	HokKey       prompt.Key
	Environments []Environment
	Description  string
	MatchFn      func(string, string) bool
	Fn           func([]string, io.Writer)
}

func (*Command) MatchAndExecute

func (cmd *Command) MatchAndExecute(args string, out io.Writer) bool

type Environment

type Environment string
const (
	Kubernetes Environment = "Kubernetes"
	Docker     Environment = "Docker"
	Rancher    Environment = "Rancher"
	Istio      Environment = "Istio"
)
var ActiveEnvironment Environment

type Register

type Register func() (*Runtime, error)

type Runtime

type Runtime struct {
	Prefix         string
	Completer      prompt.Completer
	Executor       prompt.Executor
	ExitChecker    prompt.ExitChecker
	LivePrefix     func() (prefix string, useLivePrefix bool)
	Commands       []Command
	MainSuggestion []prompt.Suggest
}

func GetActive

func GetActive() *Runtime

func GetDocker

func GetDocker() *Runtime

func GetIstio

func GetIstio() *Runtime

func GetKubernetes

func GetKubernetes() *Runtime

func GetRancher

func GetRancher() *Runtime

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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