config

package
v0.0.0-...-c4ec94d Latest Latest
Warning

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

Go to latest
Published: May 4, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(key string) interface{}

Get fetches a config value by key

func Initialize

func Initialize()

Initialize creates the directory and/or file with defaults for the application's configuration settings

func ParseAndUpdate

func ParseAndUpdate(v *viper.Viper) error

ParseAndUpdate parses the viper settings as a pls settings struct and updates the config file

func Set

func Set(key string, value string)

Set sets a config key and value and saves it to the config file

func UpdatePrompt

func UpdatePrompt(viperSettings map[string]interface{}) error

UpdatePrompt lets the user select from a dropdown of config keys for which value to update

Types

type Settings

type Settings struct {
	GitToken              string            `yaml:"git_token"`
	GitUsername           string            `yaml:"git_username"`
	GitEnterpriseToken    string            `yaml:"ghe_token"`
	GitEnterpriseUsername string            `yaml:"ghe_username"`
	GitEnterpriseHostname string            `yaml:"ghe_hostname"`
	Name                  string            `yaml:"name"`
	DefaultEditor         string            `yaml:"default_editor"`
	WebShortcuts          map[string]string `yaml:"webshort"`
	DefaultCodeDir        string            `yaml:"default_codepath"`
	// contains filtered or unexported fields
}

Settings represent the default settings for pls

func Parse

func Parse(v *viper.Viper) (Settings, error)

Parse unmarshals the viper configs into the pls settings struct

func (*Settings) UpdateSettings

func (s *Settings) UpdateSettings() error

UpdateSettings checks for pls config values that have already been set and ensures they're preserved when updating configs

Jump to

Keyboard shortcuts

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