cli

package
v1.3.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FprintBluef func(w io.Writer, format string, a ...interface{})

FprintBluef prints in green to w.

View Source
var FprintGreenf func(w io.Writer, format string, a ...interface{})

FprintGreenf prints in green to w.

View Source
var FprintRedf func(w io.Writer, format string, a ...interface{})

FprintRedf prints in green to w.

View Source
var FprintYellowf func(w io.Writer, format string, a ...interface{})

FprintYellowf prints in green to w.

View Source
var PrintBluef func(format string, a ...interface{})

PrintBluef prints in blue.

View Source
var PrintGreenf func(format string, a ...interface{})

PrintGreenf prints in green.

View Source
var PrintRedf func(format string, a ...interface{})

PrintRedf prints in red.

View Source
var PrintYellowf func(format string, a ...interface{})

PrintYellowf prints in yellow.

Functions

func AskForAction added in v1.1.0

func AskForAction(question string, options []string, reader *bufio.Reader) string

AskForAction asks the user the given question. A user must type in one of the presented options and then press enter.If the input is not recognized, it will ask again. The function does not return until it gets a valid response from the user. Options are of form "y=yes". The matching is fuzzy, which means allowed values are "y", "Y", "yes", "YES", "Yes" and so on. The returned value is always the "key" ("y" in this case), regardless if the input was "y" or "yes" etc.

func DebugMsg

func DebugMsg(messages ...string)

DebugMsg prints given message when debug mode is on.

func EditEnvFile

func EditEnvFile(content string) (string, error)

EditEnvFile opens content in EDITOR, and returns saved content.

func ExecOcCmd

func ExecOcCmd(args []string, namespace string, selector string) *exec.Cmd

ExecOcCmd executes "oc" with given namespace and selector applied.

func ExecPlainOcCmd

func ExecPlainOcCmd(args []string) *exec.Cmd

ExecPlainOcCmd executes "oc" with given arguments applied.

func RunCmd

func RunCmd(cmd *exec.Cmd) (outBytes, errBytes []byte, err error)

RunCmd runs the given command and returns the result

func VerboseMsg

func VerboseMsg(messages ...string)

VerboseMsg prints given message when verbose mode is on. Verbose mode is implicitly turned on when debug mode is on.

Types

type ClientApplier added in v1.1.0

type ClientApplier interface {
	ClientProcessorExporter
	ClientModifier
}

type ClientModifier added in v1.1.0

type ClientModifier interface {
	OcClientApplier
	OcClientDeleter
}

ClientModifier allows to delete and create/update resources.

type ClientProcessorExporter

type ClientProcessorExporter interface {
	OcClientProcessor
	OcClientExporter
}

ClientProcessorExporter allows to process templates and export resources.

type CompareOptions

type CompareOptions struct {
	*GlobalOptions
	*NamespaceOptions
	Selector                string
	Excludes                []string
	TemplateDir             string
	ParamDir                string
	PrivateKey              string
	Passphrase              string
	Labels                  string
	Params                  []string
	ParamFiles              []string
	PreservePaths           []string
	PreserveImmutableFields bool
	IgnoreUnknownParameters bool
	UpsertOnly              bool
	AllowRecreate           bool
	RevealSecrets           bool
	Verify                  bool
	Resource                string
}

CompareOptions define how to compare desired and current state.

func NewCompareOptions

func NewCompareOptions(
	globalOptions *GlobalOptions,
	namespaceFlag string,
	selectorFlag string,
	excludeFlag []string,
	templateDirFlag string,
	paramDirFlag string,
	publicKeyDirFlag string,
	privateKeyFlag string,
	passphraseFlag string,
	labelsFlag string,
	paramFlag []string,
	paramFileFlag []string,
	preserveFlag []string,
	preserveImmutableFieldsFlag bool,
	ignoreUnknownParametersFlag bool,
	upsertOnlyFlag bool,
	allowRecreateFlag bool,
	revealSecretsFlag bool,
	verifyFlag bool,
	resourceArg string) (*CompareOptions, error)

NewCompareOptions returns new options for the diff/apply command based on file/flags.

func (*CompareOptions) PathsToPreserve added in v0.12.0

func (o *CompareOptions) PathsToPreserve() []string

type ExportOptions

type ExportOptions struct {
	*GlobalOptions
	*NamespaceOptions
	Selector               string
	Excludes               []string
	TemplateDir            string
	ParamDir               string
	WithAnnotations        bool
	WithHardcodedNamespace bool
	TrimAnnotations        []string
	Resource               string
}

ExportOptions define how the export should be done.

func NewExportOptions

func NewExportOptions(
	globalOptions *GlobalOptions,
	namespaceFlag string,
	selectorFlag string,
	excludeFlag []string,
	templateDirFlag string,
	paramDirFlag string,
	withAnnotationsFlag bool,
	withHardcodedNamespaceFlag bool,
	trimAnnotationsFlag []string,
	resourceArg string) (*ExportOptions, error)

NewExportOptions returns new options for the export command based on file/flags.

type GlobalOptions

type GlobalOptions struct {
	Verbose         bool
	Debug           bool
	NonInteractive  bool
	OcBinary        string
	File            string
	Force           bool
	IsLoggedIn      bool
	ClusterRequired bool
	// contains filtered or unexported fields
}

GlobalOptions are app-wide.

func InitGlobalOptions added in v0.13.0

func InitGlobalOptions(fs utils.FileStater) *GlobalOptions

InitGlobalOptions creates a new pointer to GlobalOptions with a given filesystem.

func NewGlobalOptions

func NewGlobalOptions(
	clusterRequired bool,
	fileFlag string,
	verboseFlag bool,
	debugFlag bool,
	nonInteractiveFlag bool,
	ocBinaryFlag string,
	forceFlag bool) (*GlobalOptions, error)

NewGlobalOptions returns new global options based on file/flags. Those options are shared across all commands.

func (*GlobalOptions) FileExists added in v0.13.0

func (o *GlobalOptions) FileExists(file string) bool

FileExists checks whether given file exists.

type NamespaceOptions

type NamespaceOptions struct {
	Namespace         string
	CheckedNamespaces []string
}

NamespaceOptions define which namespace Tailor works against.

type OcClient

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

OcClient is a wrapper around the "oc" binary (client).

func NewOcClient

func NewOcClient(namespace string) *OcClient

NewOcClient creates a new ocClient.

func (*OcClient) Apply added in v0.13.0

func (c *OcClient) Apply(config string, selector string) ([]byte, error)

Apply applies given resource configuration.

func (*OcClient) CheckLoggedIn

func (c *OcClient) CheckLoggedIn() (bool, error)

CheckLoggedIn returns true if the given project (namespace) exists.

func (*OcClient) CheckProjectExists

func (c *OcClient) CheckProjectExists(p string) (bool, error)

CheckProjectExists returns true if the given project (namespace) exists.

func (*OcClient) CurrentProject

func (c *OcClient) CurrentProject() (string, error)

CurrentProject returns the currently active project name (namespace).

func (*OcClient) Delete

func (c *OcClient) Delete(kind string, name string) ([]byte, error)

Delete deletes given resource.

func (*OcClient) Export

func (c *OcClient) Export(target string, label string) ([]byte, error)

Export exports resources from OpenShift as a template.

func (*OcClient) Process

func (c *OcClient) Process(args []string) ([]byte, []byte, error)

Process processes an OpenShift template. The API is just a stop-gap solution and will be better in the future.

func (*OcClient) Version

func (c *OcClient) Version() ([]byte, []byte, error)

Version returns the output of "ov versiopn".

type OcClientApplier added in v0.13.0

type OcClientApplier interface {
	Apply(config string, selector string) ([]byte, error)
}

OcClientApplier allows to create/update a resource.

type OcClientDeleter

type OcClientDeleter interface {
	Delete(kind string, name string) ([]byte, error)
}

OcClientDeleter allows to delete a resource.

type OcClientExporter

type OcClientExporter interface {
	Export(target string, label string) ([]byte, error)
}

OcClientExporter allows to export resources.

type OcClientProcessor

type OcClientProcessor interface {
	Process(args []string) ([]byte, []byte, error)
}

OcClientProcessor is a stop-gap solution only ... should have a better API.

type OcClientVersioner

type OcClientVersioner interface {
	Version() ([]byte, []byte, error)
}

OcClientVersioner allows to retrieve the OpenShift version..

type SecretsOptions

type SecretsOptions struct {
	*GlobalOptions
	ParamDir     string
	PublicKeyDir string
	PrivateKey   string
	Passphrase   string
}

SecretsOptions define how to work with encrypted files.

func NewSecretsOptions

func NewSecretsOptions(
	globalOptions *GlobalOptions,
	paramDirFlag string,
	publicKeyDirFlag string,
	privateKeyFlag string,
	passphraseFlag string) (*SecretsOptions, error)

NewSecretsOptions returns new options for the secrets subcommand based on file/flags.

Jump to

Keyboard shortcuts

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