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

Method Add

pkg/config/config.go:98–118  ·  view source on GitHub ↗
(newApp App)

Source from the content-addressed store, hash-verified

96}
97
98func (c *Config) Add(newApp App) error {
99 if len(c.Apps) == 0 {
100 c.Default = newApp.Name
101 }
102
103 for _, app := range c.Apps {
104 if newApp.Name == app.Name {
105 return fmt.Errorf("application %q already exists", newApp.Name)
106 }
107 }
108
109 if newApp.ChatURL == "" {
110 newApp.ChatURL = DefaultChatEdgeURL
111 }
112
113 c.Apps = append(c.Apps, newApp)
114
115 viper.Set("default", c.Default)
116 viper.Set("apps", c.Apps)
117 return viper.WriteConfig()
118}
119
120func (c *Config) Remove(appName string) error {
121 var (

Callers 5

TestAddNewConfigFunction · 0.95
TestRemoveConfigFunction · 0.95
TestSetDefaultFunction · 0.95
getUrlFunction · 0.80
runQuestionnaireFunction · 0.80

Calls

no outgoing calls

Tested by 3

TestAddNewConfigFunction · 0.76
TestRemoveConfigFunction · 0.76
TestSetDefaultFunction · 0.76