cmd

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2021 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RootCmd = &cobra.Command{
	Use:           "kubecfg",
	Short:         "Synchronise Kubernetes resources with config files",
	SilenceErrors: true,
	SilenceUsage:  true,
	PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
		goflag.CommandLine.Parse([]string{})
		flags := cmd.Flags()
		out := cmd.OutOrStderr()
		log.SetOutput(out)

		logFmt := NewLogFormatter(out)
		log.SetFormatter(logFmt)

		verbosity, err := flags.GetCount(flagVerbose)
		if err != nil {
			return err
		}
		log.SetLevel(logLevel(verbosity))

		logflags := goflag.NewFlagSet(os.Args[0], goflag.ExitOnError)
		klog.InitFlags(logflags)
		logflags.Set("logtostderr", "true")
		if verbosity >= 2 {

			logflags.Set("v", fmt.Sprintf("%d", verbosity*3))
		}

		return nil
	},
}

RootCmd is the root of cobra subcommand tree

View Source
var Version = "(dev build)"

Version is overridden by main

Functions

func JsonnetVM

func JsonnetVM(cmd *cobra.Command) (*jsonnet.VM, error)

JsonnetVM constructs a new jsonnet.VM, according to command line flags

func NewLogFormatter added in v0.3.0

func NewLogFormatter(out io.Writer) log.Formatter

NewLogFormatter creates a new log.Formatter customised for writer

Types

This section is empty.

Jump to

Keyboard shortcuts

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