Documentation
¶
Index ¶
- type Config
- func (self *Config) AddWorkspace(path string, name string) error
- func (self *Config) ClearCurrentWorkspace() error
- func (self *Config) GetAllProjectMeta() []common.ProjectMeta
- func (self *Config) GetAllWorkspaceMeta() []common.WorkspaceMeta
- func (self *Config) GetCurrentWorkspace() string
- func (self *Config) GetLoggingFormat() string
- func (self *Config) GetLoggingLevel() string
- func (self *Config) GetProjectMeta(wsName string, projectName string) (common.ProjectMeta, error)
- func (self *Config) GetRuntimeConfig() *config
- func (self *Config) GetWorkspaceMeta(name string) (common.WorkspaceMeta, error)
- func (self *Config) LoadOrCreate() error
- func (self *Config) ProjectExists(wsName string, name string) (bool, error)
- func (self *Config) SetProjectPath(wsName string, name string, path string) error
- func (self *Config) SwitchWorkspace(workspaceName string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config is responsible for loading the configuration and managing it on disk. As a general rule whenever we're reading values we should be working with the runtimeConfig instance. Outside, in the main package, we should be using viper to override certain variables for the runtimeConfig with their corresponding CLI argument or environment variable equivalents. For any mutation methods, we generally should be working with the persisted config. This is too ensure that if the user has for example, overridden the logging level for a single command, we don't persist that log level permanently in the config on disk. This can be a bit finicky in practice, but takes a little care to think here about what can and cannot be overridden at the CLI or ENV levels. If anything changes in here, that cannot be overridden at those levels we should also reflect those changes for the runtimeConfig.
func (*Config) AddWorkspace ¶
AddWorkspace adds a new workspace to the configuration on disk. In the case of adding a new workspace it should also update the workspaces for the inUse config as it cannot be overridden by any CLI arguments or environment variables.
func (*Config) ClearCurrentWorkspace ¶
ClearCurrentWorkspace deselects any workspace on a global level.
func (*Config) GetAllProjectMeta ¶
func (self *Config) GetAllProjectMeta() []common.ProjectMeta
func (*Config) GetAllWorkspaceMeta ¶
func (self *Config) GetAllWorkspaceMeta() []common.WorkspaceMeta
GetWorkspaceLocations returns a tuple with the name and path for each workspace.
func (*Config) GetCurrentWorkspace ¶
TODO: add a test
func (*Config) GetLoggingFormat ¶
func (*Config) GetLoggingLevel ¶
func (*Config) GetProjectMeta ¶
func (*Config) GetRuntimeConfig ¶
func (self *Config) GetRuntimeConfig() *config
func (*Config) GetWorkspaceMeta ¶
func (self *Config) GetWorkspaceMeta(name string) (common.WorkspaceMeta, error)
GetWorkspaceLocation returns a tuple with name and path for the given namespace if it does in fact exist. If it doesn't exist an error is returned.
func (*Config) LoadOrCreate ¶
func (*Config) ProjectExists ¶
func (*Config) SetProjectPath ¶
func (*Config) SwitchWorkspace ¶
SwitchWorkspace changes the current workspace in the configuration on disk. As this can be overridden by the CLI arguments or environment variables, we don't update the inUse configuration.