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

Method Remove

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

Source from the content-addressed store, hash-verified

118}
119
120func (c *Config) Remove(appName string) error {
121 var (
122 idx int
123 found bool
124 )
125 for i, app := range c.Apps {
126 if appName == app.Name {
127 found = true
128 idx = i
129 break
130 }
131 }
132 if !found {
133 return fmt.Errorf("application %q doesn't exist", appName)
134 }
135
136 if c.Default == appName {
137 c.Default = ""
138 }
139
140 c.Apps = append(c.Apps[:idx], c.Apps[idx+1:]...)
141
142 viper.Set("default", c.Default)
143 viper.Set("apps", c.Apps)
144 return viper.WriteConfig()
145}
146
147func (c *Config) SetDefault(appName string) error {
148 if c.Default == appName {

Callers 6

TestRemoveConfigFunction · 0.95
TestFileUploadAndDeleteFunction · 0.80
TestImageUploadAndDeleteFunction · 0.80
removeAppCmdFunction · 0.80
getTempFileFunction · 0.80

Calls

no outgoing calls

Tested by 5

TestRemoveConfigFunction · 0.76
TestFileUploadAndDeleteFunction · 0.64
TestImageUploadAndDeleteFunction · 0.64
getTempFileFunction · 0.64