Documentation ¶
Index ¶
- type Config
- type Option
- type Storage
- func (m *Storage) Default() (string, error)
- func (m *Storage) Delete(n string) error
- func (m *Storage) List() ([]string, error)
- func (m *Storage) Load(n string) (*Config, error)
- func (m *Storage) Rename(from, to string) error
- func (m *Storage) Set(n string, c *Config) error
- func (m *Storage) SetDefault(n string) error
- func (m *Storage) UnsetDefault() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Server is the configuration to talk to a Waypoint server. Server serverconfig.Client `hcl:"server,block"` }
Config is the structure of the context configuration file. This structure can be decoded with hclsimple.DecodeFile.
type Option ¶
func WithDir ¶
WithDir specifies the directory where context configuration will be stored. This doesn't have to exist already but we must have permission to create it.
func WithNoSymlink ¶ added in v0.1.3
func WithNoSymlink() Option
WithNoSymlink disables all symlink usage in the Storage. If symlinks were used previously then they'll still work.
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage is the primary struct for interacting with stored CLI contexts. Contexts are always stored directly on disk with one set as the default.
func NewStorage ¶
NewStorage initializes context storage.
func TestStorage ¶
func TestStorage(t testing.T) *Storage
TestStorage returns a *Storage pointed at a temporary directory. This will cleanup automatically by using t.Cleanup.
func (*Storage) Rename ¶
Rename renames a context. This will error if the "from" context does not exist. If "from" is the default context then the default will be switched to "to". If "to" already exists, this will overwrite it.
func (*Storage) Set ¶
Set will set a new configuration with the given name. This will overwrite any existing context of this name.
func (*Storage) SetDefault ¶
SetDefault sets the default context to use. If the given context doesn't exist, an os.IsNotExist error will be returned.
func (*Storage) UnsetDefault ¶
UnsetDefault unsets the default context.