Documentation
¶
Overview ¶
Package pungi provides a reusable `config` cobra command for viper-backed CLI tools. Supports list, get, set, and edit subcommands with dot-path YAML navigation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Set ¶
Set persists a key/value pair into the config FILE through a fresh viper instance loaded only from that file — never the global one. The global instance carries every cobra-bound flag, so writing it serializes flag state into the user's config, leaving a blank entry for every flag the command declared. A fresh instance never saw a flag: legitimate user config in any namespace round-trips untouched and flag keys cannot leak in. The global instance is updated in-memory afterwards so the running process stays coherent.
func SortAlphabetical ¶
func SortAlphabetical(keys []string)
SortAlphabetical is the default sorter — alphabetical order.
Types ¶
type KeySorter ¶
type KeySorter func(keys []string)
KeySorter defines sort order for config keys in list output.
type KeyValidator ¶
KeyValidator validates a config key before writing. Return an error to reject.
type Options ¶
type Options struct {
// Validate is called before set operations. Defaults to AcceptAll.
Validate KeyValidator
// Sort defines key ordering for list output. Defaults to SortAlphabetical.
Sort KeySorter
}
Options configures the config command.