Documentation ¶
Overview ¶
Package config handles the user configations.
Index ¶
- Constants
- Variables
- func Alert(w io.Writer, list ...string) error
- func CmdPath() string
- func ConfigMissing(w io.Writer, name, suffix string)
- func Create(w io.Writer, name string, ow bool) error
- func CtrlC(w io.Writer)
- func Delete(w io.Writer, ask bool) error
- func DoesExist(w io.Writer, name, suffix string) error
- func Edit(w io.Writer) error
- func Enabled() map[string]interface{}
- func Info(w io.Writer, style string) error
- func InitDefaults()
- func List(w io.Writer) error
- func Load(w io.Writer, flag string) error
- func Location() string
- func Logo(w io.Writer) error
- func Missing() []string
- func New(w io.Writer, overwrite bool) error
- func Path() string
- func Save(w io.Writer, name string) error
- func Set(w io.Writer, name string) error
- func Setup(w io.Writer, start int) error
- func SortKeys() []string
- func Tip() get.Hints
- func Update(w io.Writer, name string, setup bool) error
- type Formats
Constants ¶
const ( ClearScreen = "\033c" ResetScreen = "\033[0m" )
const NameFile = "config.yaml"
Variables ¶
var ( ErrEditorNil = errors.New("no suitable text editor can be found") ErrEditorRun = errors.New("editor cannot be run") ErrLogo = errors.New("program logo is missing") )
var ( ErrConfigName = errors.New("viper config file cannot be empty") ErrWriter = errors.New("writer cannot be nil") )
var ErrEd = errors.New("there is no configuration file to edit")
var ErrExist = errors.New("a config file already exists")
var ErrStart = errors.New("setup start argument is out of range")
Functions ¶
func ConfigMissing ¶ added in v0.0.38
ConfigMissing writes an config file error notice.
func DoesExist ¶ added in v0.0.38
DoesExist writes a how-to help message when a config file already exists.
func Enabled ¶
func Enabled() map[string]interface{}
Enabled returns all the Viper keys holding a value that are used. This will hide all unrecognized manual edits to the configuration file.
func Load ¶ added in v0.0.38
Load and reads a configuration file. The string argument should be the value of the hidden config flag.
func Location ¶ added in v0.0.33
func Location() string
Location returns the absolute path of the current configuration file and the status of any missing settings.
func Missing ¶
func Missing() []string
Missing returns the settings that are not found in the configuration file. This could be due to new features being added after the file was generated or because of manual file edits.
func Set ¶
Set edits and saves a named setting within a configuration file. It also accepts numeric index values printed by List().
func Setup ¶
Setup walks through all the settings and saves them to the configuration file. The start argument can being the walkthrough at the provided question number or it can be left at 0.
func SortKeys ¶ added in v0.0.38
func SortKeys() []string
SortKeys list all the available configuration setting names sorted by hand.