cmdutil

package
v0.43.1 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package cmdutil contains shared Cobra command helpers.

Index

Constants

View Source
const VisibilityLevelsUnsupported = "the server does not support visibility levels yet"

VisibilityLevelsUnsupported explains a response without a visibility: the server predates the levels, so any level the CLI reported would be a guess.

Variables

This section is empty.

Functions

func HideDeprecatedAlias

func HideDeprecatedAlias(cmd *cobra.Command, warning string) *cobra.Command

HideDeprecatedAlias hides cmd from help and prints warning before legacy paths run.

func ParseJSONObject added in v0.26.0

func ParseJSONObject(subject, value string) (map[string]any, error)

ParseJSONObject reads a flag value that carries a JSON object, either inline or as the path to a file holding it. subject names the flag in errors, so they read as "payload must be a JSON object" or "input must be a JSON object".

func VisibilityLevelsHint added in v0.42.0

func VisibilityLevelsHint(deps cliruntime.Deps) string

VisibilityLevelsHint follows a bare 400 for a request that sets a visibility level, which a server that predates the levels refuses as malformed.

Types

type PrivateHint added in v0.42.0

type PrivateHint struct {
	// Summary says who can call a private function of this kind.
	Summary string
	// Instruction introduces the commands Open returns.
	Instruction string
	// Open returns the command that lets signed-in users call the function.
	Open         func(name string) string
	ConfigDeploy string
	// ConfigFirst offers config deploy ahead of Open, for a kind whose Open
	// command rebuilds the function.
	ConfigFirst bool
	// Declared is the level volcano-config.yaml declares for each function.
	Declared map[string]string
}

PrivateHint is what a deploy prints about the new functions that came up private. A deploy does not apply the manifest's visibility, so a function the manifest gives another level is pointed at config deploy, and one the manifest keeps private gets no hint.

func (PrivateHint) Print added in v0.42.0

func (h PrivateHint) Print(out io.Writer, names []string)

Print writes the hint for names, the new functions that came up private.

type VisibilityFlags added in v0.42.0

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

VisibilityFlags holds --visibility, its --public alias, and the retired --private.

func (*VisibilityFlags) Register added in v0.42.0

func (f *VisibilityFlags) Register(flags *pflag.FlagSet, usage string)

Register adds the flags. usage describes --visibility for the command.

func (*VisibilityFlags) Set added in v0.42.0

func (f *VisibilityFlags) Set() bool

Set reports whether any of the flags was given.

func (*VisibilityFlags) Visibility added in v0.42.0

func (f *VisibilityFlags) Visibility() (visibility apiclient.FunctionVisibility, ok bool, err error)

Visibility returns the level the flags select. ok is false when none was given.

Jump to

Keyboard shortcuts

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