util

package
v0.0.0-...-8dda575 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CmdUsageTemplate = `` /* 963-byte string literal not displayed */

CmdUsageTemplate is the main template used for all command line usage

Functions

func CapitalizeFlagDescriptions

func CapitalizeFlagDescriptions(f *pflag.FlagSet) string

CapitalizeFlagDescriptions adds capitalizations

func CheckOutputFlag

func CheckOutputFlag(outputFlag string) error

CheckOutputFlag validates the -o flag

func GetFullName

func GetFullName(parentName, name string) string

GetFullName generates a command's full name based on its parent's full name and its own name

func LogErrorAndExit

func LogErrorAndExit(err error, context string, a ...interface{})

LogErrorAndExit prints the cause of the given error and exits the code with an exit code of 1. If the context is provided, then that is printed, if not, then the cause is detected using errors.Cause(err) *If* we are using the global json parameter, we instead output the json output

func ModifyAdditionalFlags

func ModifyAdditionalFlags(cmd *cobra.Command) string

ModifyAdditionalFlags modifies the flags and updates the descriptions as well as changes whether or not machine readable output has been passed in..

Return the flag usages for the help outout

func PrintComponentInfo

func PrintComponentInfo(client *occlient.Client, currentComponentName string, componentDesc component.Component, applicationName string, project string)

PrintComponentInfo prints Component Information like path, URL & storage

func ThrowContextError

func ThrowContextError() error

ThrowContextError prints a context error if application/project is not found

func VisitCommands

func VisitCommands(cmd *cobra.Command, f func(*cobra.Command))

VisitCommands visits each command within Cobra. Adapted from: https://github.com/cppforlife/knctl/blob/612840d3c9729b1c57b20ca0450acab0d6eceeeb/pkg/knctl/cobrautil/misc.go#L23

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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