MCPcopy Create free account
hub / github.com/GetStream/stream-cli / SetDefault

Method SetDefault

pkg/config/config.go:147–167  ·  view source on GitHub ↗
(appName string)

Source from the content-addressed store, hash-verified

145}
146
147func (c *Config) SetDefault(appName string) error {
148 if c.Default == appName {
149 // if already default, early return
150 return nil
151 }
152
153 var found bool
154 for _, app := range c.Apps {
155 if appName == app.Name {
156 found = true
157 break
158 }
159 }
160 if !found {
161 return fmt.Errorf("application %q doesn't exist", appName)
162 }
163
164 c.Default = appName
165 viper.Set("default", c.Default)
166 return viper.WriteConfig()
167}
168
169func GetConfig(cmd *cobra.Command) *Config {
170 cfg := &Config{}

Callers 2

TestSetDefaultFunction · 0.95
setAppDefaultCmdFunction · 0.80

Calls

no outgoing calls

Tested by 1

TestSetDefaultFunction · 0.76