Documentation
¶
Overview ¶
Package cmdlib contains shared functions for the bundle CLI commands.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var GlobalOptionsValues = &GlobalOptions{}
GlobalOptionsValues is a global tracker for global options (for command line executions only).
Functions ¶
func ExitWithHelp ¶
ExitWithHelp exits and prints the help message.
Types ¶
type BundleReaderWriter ¶ added in v0.8.0
type BundleReaderWriter interface {
ReadBundleData(context.Context, *GlobalOptions) (*wrapper.BundleWrapper, error)
WriteBundleData(context.Context, *wrapper.BundleWrapper, *GlobalOptions) error
WriteStructuredContents(context.Context, interface{}, *GlobalOptions) error
}
BundleReaderWriter provides a mockable reading / writing interface for reading / writing bundle data.
func NewBundleReaderWriter ¶ added in v0.8.0
func NewBundleReaderWriter(rw files.FileReaderWriter, stdio StdioReaderWriter) BundleReaderWriter
NewBundleReaderWriter creates a new BundleReaderWriter.
type CobraActionFunc ¶
CobraActionFunc provides a common type for all Cobra commands.
func ContextAction ¶
func ContextAction(ctx context.Context, f ContextActionFunc) CobraActionFunc
ContextAction returns a CobraActionFunc for a provided ContextActionFunc.
type ContextActionFunc ¶
ContextActionFunc is a common type for providing a context to a Cobra function.
type GlobalOptions ¶
type GlobalOptions struct {
// InputFile is a path to an input file. If a file is not specified, it's
// assumed the input is provided via STDIN.
InputFile string
// InputFormat is the text format for the input. By default, assumes YAML
// but also can be JSON.
InputFormat string
// OutputFormat is the the format for any output. By default, assumes YAML.
OutputFormat string
// Inline indicates whether to inline the components in the bundle builders
// or component builders before doing any processing.
Inline bool
}
GlobalOptions are options that apply to all commands
func (*GlobalOptions) Copy ¶
func (g *GlobalOptions) Copy() *GlobalOptions
Copy creates an options copy.
type RealStdioReaderWriter ¶ added in v0.8.0
type RealStdioReaderWriter struct{}
RealStdioReaderWriter provides a real STDIN / STDOUT implementation.
func (*RealStdioReaderWriter) ReadAll ¶ added in v0.8.0
func (r *RealStdioReaderWriter) ReadAll() ([]byte, error)
ReadAll reads all the input from STDIN.