util

package
v3.31.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeprecateFlag

func DeprecateFlag(flagSet *pflag.FlagSet, old string, new string)

DeprecateFlag deprecates a CLI flag.

func DeprecateFlagWithoutForwarding added in v3.25.1

func DeprecateFlagWithoutForwarding(flagSet *pflag.FlagSet, flag string, reason string)

DeprecateFlagWithoutForwarding deprecates a CLI flag without forwarding it to a new flag.

func ForwardFlag

func ForwardFlag(flagSet *pflag.FlagSet, old string, new string)

ForwardFlag forwards the flag value of old to new if new is not set while old is.

func HideFlag added in v3.12.0

func HideFlag(flagSet *pflag.FlagSet, name string)

HideFlag hides the provided flag from the flag set.

func HideFlagSet added in v3.12.0

func HideFlagSet(flagSet *pflag.FlagSet) *pflag.FlagSet

HideFlagSet hides the flags from the provided flag set.

func NormalizeFlags

func NormalizeFlags(f *pflag.FlagSet, name string) pflag.NormalizedName

func NormalizePaths

func NormalizePaths(paths []string) []string

NormalizePaths converts arguments to field mask paths, replacing '-' with '_'

func NormalizedFlagSet added in v3.19.2

func NormalizedFlagSet() *pflag.FlagSet

NormalizedFlagSet returns a flagset with a NormalizeFunc that replaces underscores to dashes.

func SaveAuthCache

func SaveAuthCache(cache AuthCache) (err error)

SaveAuthCache saves the auth cache to the cache file.

func SelectAllFlagSet

func SelectAllFlagSet(what string) *pflag.FlagSet

SelectAllFlagSet returns a flagset with the --all flag

func SelectFieldMask

func SelectFieldMask(cmdFlags *pflag.FlagSet, fieldMaskFlags ...*pflag.FlagSet) (paths []string)

func UnsetFlagSet

func UnsetFlagSet() *pflag.FlagSet

UnsetFlagSet returns a flagset with the --unset flag

func UpdateFieldMask

func UpdateFieldMask(cmdFlags *pflag.FlagSet, fieldMaskFlags ...*pflag.FlagSet) (paths []string)

Types

type AuthCache

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

AuthCache stores auth for the CLI.

func GetAuthCache

func GetAuthCache() (cache AuthCache, err error)

GetAuthCache gets the auth cache form the cache file.

func (AuthCache) ForID

func (c AuthCache) ForID(id string) AuthCache

ForID returns the auth cache for the given ID.

func (*AuthCache) Get

func (c *AuthCache) Get(key string) any

Get gets a key from the auth cache.

func (*AuthCache) Set

func (c *AuthCache) Set(key string, value any)

Set sets keys in the auth cache.

func (*AuthCache) Unset

func (c *AuthCache) Unset(keys ...string)

Unset unsets keys in the auth cache.

type AuthData

type AuthData struct {
	OAuthToken *oauth2.Token  `json:"oauth_token,omitempty"`
	APIKey     string         `json:"api_key,omitempty"`
	Hosts      []string       `json:"hosts,omitempty"`
	Other      map[string]any `json:"other,omitempty"`
}

AuthData is the stored auth data.

Jump to

Keyboard shortcuts

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