Documentation ¶
Overview ¶
Package settings contains the logic for reading, writing, associating profiles with a user's settings file. It also configures a Tharsis SDK client.
Index ¶
Constants ¶
View Source
const ( // SettingsDirectoryName is the name of directory where settings reside. SettingsDirectoryName = ".tharsis" // SettingsFilename is the name of the settings file. SettingsFilename = "settings.json" // DefaultProfileName is the name of the default profile DefaultProfileName = "default" )
Variables ¶
View Source
var ( // ErrNoSettings is a special error if settings file does not exist. ErrNoSettings = fmt.Errorf(noSettingsMessage) )
Functions ¶
func DefaultSettingsFilename ¶
DefaultSettingsFilename returns the OS-dependent path/name of the default settings file.
Types ¶
type Settings ¶
type Settings struct { Profiles map[string]Profile `json:"profiles"` CurrentProfile *Profile `json:"-"` // This field is not persistent, do not write it out. }
Settings holds the contents of one settings file and a pointer to the profile specified by the current command.
func ReadSettings ¶
ReadSettings reads the settings file. If no argument, it reads the default settings file: ~/.tharsis/settings.json
func (*Settings) SetCurrentProfile ¶
SetCurrentProfile sets the current profile pointer in a settings object.
func (*Settings) WriteSettingsFile ¶
WriteSettingsFile reads the settings file. If no filename argument, it writes the default settings file: ~/.tharsis/settings.json
Click to show internal directories.
Click to hide internal directories.