Documentation ¶
Index ¶
- Variables
- type ConfirmationMessage
- type DefaultTerminal
- func (t *DefaultTerminal) AskForConfirmation(msg ConfirmationMessage) bool
- func (t *DefaultTerminal) InOrStdin() io.Reader
- func (t *DefaultTerminal) OutOrStdout() io.Writer
- func (t *DefaultTerminal) PrintContextSeparatorWithBodyf(body, context string, args ...interface{})
- func (t *DefaultTerminal) PrintContextSeparatorf(context string, args ...interface{})
- func (t *DefaultTerminal) PrintObject(object runtime.Object, title string) error
- func (t *DefaultTerminal) Printf(format string, args ...interface{})
- func (t *DefaultTerminal) Println(msg string)
- func (t *DefaultTerminal) Printlnf(format string, args ...interface{})
- type Terminal
Constants ¶
This section is empty.
Variables ¶
var AssumeYes bool
AssumeYes automatically answers yes for all questions.
Functions ¶
This section is empty.
Types ¶
type ConfirmationMessage ¶
type ConfirmationMessage string
func WithDangerZoneMessagef ¶
func WithDangerZoneMessagef(consequence, action string, args ...interface{}) ConfirmationMessage
func WithMessagef ¶
func WithMessagef(action string, args ...interface{}) ConfirmationMessage
type DefaultTerminal ¶
type DefaultTerminal struct {
// contains filtered or unexported fields
}
DefaultTerminal a wrapper around a Cobra command, with extra methods to display messages.
func (*DefaultTerminal) AskForConfirmation ¶
func (t *DefaultTerminal) AskForConfirmation(msg ConfirmationMessage) bool
func (*DefaultTerminal) InOrStdin ¶
func (t *DefaultTerminal) InOrStdin() io.Reader
InOrStdin returns an `io.Reader` to read the user's input
func (*DefaultTerminal) OutOrStdout ¶
func (t *DefaultTerminal) OutOrStdout() io.Writer
OutOrStdout returns an `io.Writer` to write messages in the console
func (*DefaultTerminal) PrintContextSeparatorWithBodyf ¶
func (t *DefaultTerminal) PrintContextSeparatorWithBodyf(body, context string, args ...interface{})
PrintContextSeparatorWithBodyf prints the context separator and a message
func (*DefaultTerminal) PrintContextSeparatorf ¶
func (t *DefaultTerminal) PrintContextSeparatorf(context string, args ...interface{})
PrintContextSeparatorf prints the context separator (only)
func (*DefaultTerminal) PrintObject ¶
func (t *DefaultTerminal) PrintObject(object runtime.Object, title string) error
PrintObject prints the given object
func (*DefaultTerminal) Printf ¶
func (t *DefaultTerminal) Printf(format string, args ...interface{})
Printf prints the given message with arguments
func (*DefaultTerminal) Println ¶
func (t *DefaultTerminal) Println(msg string)
Println prints the given message and appends a line feed
func (*DefaultTerminal) Printlnf ¶
func (t *DefaultTerminal) Printlnf(format string, args ...interface{})
Printlnf prints the given message with arguments and appends a line feed
type Terminal ¶
type Terminal interface { InOrStdin() io.Reader OutOrStdout() io.Writer AskForConfirmation(msg ConfirmationMessage) bool Println(msg string) Printlnf(msg string, args ...interface{}) PrintContextSeparatorf(context string, args ...interface{}) PrintContextSeparatorWithBodyf(body, context string, args ...interface{}) PrintObject(object runtime.Object, title string) error }
Terminal a wrapper around a Cobra command, with extra methods to display messages.