config

package
v3.22.0 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package config provides commands for managing CLI configuration

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetConfigValue

func SetConfigValue(conf *config.Config, key ConfigKey, value string, local bool) error

Types

type ConfigCmd

type ConfigCmd struct {
	List  ListCmd  `cmd:"" help:"List configuration values." aliases:"ls"`
	Get   GetCmd   `cmd:"" help:"Get a configuration value."`
	Set   SetCmd   `cmd:"" help:"Set a configuration value."`
	Unset UnsetCmd `cmd:"" help:"Remove a configuration value."`
}

ConfigCmd is the root command for managing CLI configuration

func (ConfigCmd) Help

func (c ConfigCmd) Help() string

type ConfigKey

type ConfigKey string

ConfigKey represents a valid configuration key

const (
	KeySelectedOrg  ConfigKey = "selected_org"
	KeyOutputFormat ConfigKey = "output_format"
	KeyNoPager      ConfigKey = "no_pager"
	KeyQuiet        ConfigKey = "quiet"
	KeyNoInput      ConfigKey = "no_input"
	KeyPager        ConfigKey = "pager"
)

func AllKeys

func AllKeys() []ConfigKey

AllKeys returns all valid configuration keys

func ValidateKey

func ValidateKey(key string) (ConfigKey, error)

ValidateKey checks if a key is valid

func (ConfigKey) IsBool

func (k ConfigKey) IsBool() bool

IsBool returns true if the key is a boolean value

func (ConfigKey) IsLocalOnly

func (k ConfigKey) IsLocalOnly() bool

IsLocalOnly returns true if the key can only be set in user config

func (ConfigKey) IsUserOnly

func (k ConfigKey) IsUserOnly() bool

IsUserOnly returns true if the key can only be set in user config

func (ConfigKey) ValidValues

func (k ConfigKey) ValidValues() []string

ValidValues returns valid values for enum keys, or nil if any value is valid

type GetCmd

type GetCmd struct {
	Key string `arg:"" help:"Configuration key to get"`
}

func (*GetCmd) Help

func (c *GetCmd) Help() string

func (*GetCmd) Run

func (c *GetCmd) Run() error

type ListCmd

type ListCmd struct {
	Local  bool `help:"Only show local configuration" xor:"scope"`
	Global bool `help:"Only show global (user) configuration" xor:"scope"`
}

func (*ListCmd) Help

func (c *ListCmd) Help() string

func (*ListCmd) Run

func (c *ListCmd) Run() error

type SetCmd

type SetCmd struct {
	Key   string `arg:"" help:"Configuration key to set"`
	Value string `arg:"" help:"Value to set"`
	Local bool   `help:"Save to local (.bk.yaml) instead of user config"`
}

func (*SetCmd) Help

func (c *SetCmd) Help() string

func (*SetCmd) Run

func (c *SetCmd) Run() error

type UnsetCmd

type UnsetCmd struct {
	Key   string `arg:"" help:"Configuration key to unset"`
	Local bool   `help:"Unset from local (.bk.yaml) instead of user config"`
}

func (*UnsetCmd) Help

func (c *UnsetCmd) Help() string

func (*UnsetCmd) Run

func (c *UnsetCmd) Run() error

Jump to

Keyboard shortcuts

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