Documentation
¶
Index ¶
- Constants
- Variables
- func BinaryExists(binName, hint string) bool
- func CurrentDir() string
- func EnhanceHelper(command *cobra.Command)
- func Execute(command string) *gocmd.Cmd
- func ExecuteInDir(dir, name string, args ...string) *gocmd.Cmd
- func NewDevelopCmd() *cobra.Command
- func NewInstallCmd() *cobra.Command
- func NewRootCmd() *cobra.Command
- func NewServeCmd() *cobra.Command
- func NewVersionCmd() *cobra.Command
- func NewWatchCmd() *cobra.Command
- func RedirectStreams(src *gocmd.Cmd, stdoutDest, stderrDest io.Writer, done <-chan gocmd.Status)
- func ShutdownHook(cmd *gocmd.Cmd, done <-chan gocmd.Status)
- func Start(cmd *gocmd.Cmd, done chan gocmd.Status)
- func ToOptions(flags *pflag.FlagSet) (session.Options, error)
Constants ¶
const ( OnlyUsageString = "{{if or .Runnable .HasSubCommands}}{{.UsageString}}{{end}}" ADocHelpTable = `{{if .HasAvailableLocalFlags}}{{ $tick := "` + "`" + `" }} [cols="2,4,2,1"] |=== |Option|Purpose|Format|Default {{range localFlagsSlice .LocalFlags}}{{ if not .Hidden }} |{{$tick}}--{{.Name}}{{$tick}} {{if .Shorthand}}({{$tick}}-{{.Shorthand}}{{$tick}}){{end}} |{{.Usage}} |{{type .}} |{{if .DefValue}}{{$tick}}{{.DefValue | trimTrailingWhitespaces}}{{$tick}}{{end}}{{end}} {{end}} |=== {{end}}` )
Variables ¶
var BufferAndStreamOutput = gocmd.Options{ Buffered: true, Streaming: true, }
BufferAndStreamOutput sets buffering and streaming of output when running gocmd.Cmd Buffering lets easy inspection of outputs in tests through inspecting gocmd.Cmd.Status.Stdout/err slices
var StreamOutput = gocmd.Options{ Buffered: false, Streaming: true, }
StreamOutput sets streaming of output instead of buffering it when running gocmd.Cmd
Functions ¶
func BinaryExists ¶
BinaryExists ensures that binary with given name (binName) is available on the PATH hint lets you customize the error message
func CurrentDir ¶
func CurrentDir() string
CurrentDir returns current directory from where binary is executed
func EnhanceHelper ¶
EnhanceHelper wraps helper function with alternative formatting and templates (e.g. asciidoc) based on --helper-format flag Applies to all subcommands. This can be useful when automatically generating documentation for CLI
func Execute ¶
Execute executes given command in the current directory Adds shutdown hook and redirects streams to stdout/err
func ExecuteInDir ¶
ExecuteInDir executes given command in the defined directory Adds shutdown hook and redirects streams to stdout/err
func NewDevelopCmd ¶
NewDevelopCmd creates instance of "develop" Cobra Command with flags and execution logic defined
func NewInstallCmd ¶
NewInstallCmd takes care of deploying server-side components of istio-workspace
func NewRootCmd ¶
NewRootCmd creates instance of root "ike" Cobra Command with flags and execution logic defined
func NewServeCmd ¶
NewServeCmd creates instance of "ike serve" Cobra Command which is intended to be ran in the cluster as it starts istio-workspace operator
func NewVersionCmd ¶
NewVersionCmd creates version cmd which prints version and build details of the executed binary
func NewWatchCmd ¶
NewWatchCmd creates watch command which observes file system changes in the defined set of directories and re-runs build and run command when they occur. It is hidden (not user facing) as it's integral part of develop command
func RedirectStreams ¶
RedirectStreams redirects Stdout and Stderr of the gocmd.Cmd process to passed io.Writers
func ShutdownHook ¶
ShutdownHook will wait for SIGTERM signal and stop the cmd unless done receiving channel passed to it receives status or is closed
Types ¶
This section is empty.