Documentation ¶
Index ¶
- Constants
- func LoadOrInit(name string) error
- func RemoveAlias(alias string)
- func Save(name string) error
- func SetAlias(alias string, cfg *AliasConfig) bool
- type AliasConfig
- type Config
- func (c *Config) GetAlias(alias string) (*AliasConfig, bool)
- func (c *Config) Load(name string) error
- func (c *Config) LoadOrInit(name string) error
- func (c *Config) RemoveAlias(alias string)
- func (c *Config) Save(name string) error
- func (c *Config) SetAlias(alias string, cfg *AliasConfig) bool
- func (c *Config) WriteTo(w io.Writer) (int64, error)
Constants ¶
View Source
const (
ClientVersion = "0.1"
)
Variables ¶
This section is empty.
Functions ¶
func LoadOrInit ¶
LoadOrInit loads default config from given file. If file not exists, it will create file, and returns default config.
func SetAlias ¶
func SetAlias(alias string, cfg *AliasConfig) bool
SetAlias sets an alias for default Config.
Types ¶
type AliasConfig ¶
type AliasConfig struct { URL string `json:"url"` SecretID string `json:"secretID"` SecretKey string `json:"secretKey"` }
AliasConfig is a COS bucket config.
func GetAlias ¶
func GetAlias(alias string) (*AliasConfig, bool)
GetAlias gets alias from default Config.
type Config ¶
type Config struct { Version string `json:"version"` Aliases map[string]*AliasConfig `json:"aliases"` // contains filtered or unexported fields }
Config is cos-cli config
func (*Config) GetAlias ¶
func (c *Config) GetAlias(alias string) (*AliasConfig, bool)
GetAlias return the AliasConfig that named alias, if alias not exist, it returns nil, false.
func (*Config) LoadOrInit ¶
func (*Config) RemoveAlias ¶
RemoveAlias removes alias from config.
Click to show internal directories.
Click to hide internal directories.