cmdlib

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package cmdlib contains shared functions for the bundle CLI commands.

Index

Constants

View Source
const DefaultFilePermissions = os.FileMode(0644)

DefaultFilePermissions is the permission used for the bundle output file (rw-r--r--).

Variables

View Source
var GlobalOptionsValues = &GlobalOptions{}

GlobalOptionsValues is a global tracker for global options (for command line executions only).

Functions

func ExitWithHelp

func ExitWithHelp(cmd *cobra.Command, err string)

ExitWithHelp exits and prints the help message.

func ReadBundle added in v0.6.0

ReadBundle reads component data file contents from a file or stdin.

func WriteStructuredContents

func WriteStructuredContents(ctx context.Context, obj interface{}, rw files.FileReaderWriter, g *GlobalOptions) error

WriteStructuredContents writes some structured contents from some object `obj`. The contents must be serializable to both JSON and YAML.

Types

type CobraActionFunc

type CobraActionFunc func(cmd *cobra.Command, args []string)

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

type ContextActionFunc func(ctx context.Context, cmd *cobra.Command, args []string)

ContextActionFunc is a common type for providing a context to a Cobra function.

type GlobalOptions

type GlobalOptions struct {
	// A path to a bundle file.
	BundleFile string

	// Format for the input. By default, assumes YAML.
	InputFormat string

	// Path for an output file.
	OutputFile string

	// The format for any output. By default, assumes YAML.
	OutputFormat string

	// Whether to inline the components in the bundle before doing any processing
	InlineComponents bool

	// Whether to inline tho objects before doing any processing (typically
	// requires InlineComponents to be useful)
	InlineObjects bool
}

GlobalOptions are options that apply to all commands

func (*GlobalOptions) Copy

func (g *GlobalOptions) Copy() *GlobalOptions

Copy creates an options copy.

Jump to

Keyboard shortcuts

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