settings

package
v0.0.0-...-2b6d021 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2023 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exists

func Exists() (bool, error)

Exists test if any settings file exists

func Remove

func Remove() error

Remove will completely remove a settings file

func Reset

func Reset() error

Reset will reinitialize the settings var with the defaults, useful for debugging or completely resetting customized settings and here to be called from the cli to reset a user's workstation

func SavePath

func SavePath() (string, error)

SavePath is a helper for setting up the user's home path

func Write

func Write() error

Write will write a settings structure to the default file save location

Types

type Data

type Data struct {
	Token string `yaml:"token"`
	URL   string `yaml:"url"`
}

Data is the settings entry which holds settings data, currently this is only the current JWT token for making requests

type Settings

type Settings struct {
	Data Data
}

Settings is the container for the cli settings

func Load

func Load() (*Settings, error)

Load will load an existing settings file from the default save location

func NewSettingsWithDefaults

func NewSettingsWithDefaults() Settings

NewSettingsWithDefaults returns a settings object with data defaults set, primarily to encapsulate defaults that can be over-ridden by those in the know via btck settings set-url --key=value

func Read

func Read() (*Settings, error)

Read will read the settings from the settings path

func (Settings) ToYAML

func (s Settings) ToYAML() ([]byte, error)

ToYAML returns the settings serialized back as it's saved YAML format, primarily for printing to stdout

Jump to

Keyboard shortcuts

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