environments

package
v1.1.20210707 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2021 License: Apache-2.0 Imports: 22 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{}
View Source
var Version = "Development Build"

DO NOT modify this, will inject form Git tags by CI/CD

Functions

func BuildPromptKeyBinds

func BuildPromptKeyBinds() []prompt.KeyBind

func ExecuteAndGetResult

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

func Executor

func Executor(program string, args string, env ...string)

func GetActiveCompleter

func GetActiveCompleter() prompt.Completer

Return active completer

func GetActiveExecutor

func GetActiveExecutor() prompt.Executor

Return active executor

func GetDefaultExecutor

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

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
	Provider        string
	Description     string
	Alias           string
	MatchFn         func(string, string) bool
	Fn              func([]string, io.Writer)
	ExtendArguments []prompt.Suggest
	ExtendOptions   []prompt.Suggest
}

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  *suggestions.GenericCompleter
	Executor   prompt.Executor
	Setup      func()
	LivePrefix func() (prefix string, useLivePrefix bool)
	Commands   []Command
}

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

func TimeoutRegister added in v1.0.20210621

func TimeoutRegister(fn Register, timeout time.Duration) (*Runtime, error)

type RuntimeCompleter added in v1.1.20210626

type RuntimeCompleter struct {
	*suggestions.GenericCompleter
	*Runtime
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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