Skip to content
This repository was archived by the owner on Oct 10, 2023. It is now read-only.

Commit 458ccb0

Browse files
authored
Added feedback messages for successful execution of plugin commands (#3291)
1 parent f22976c commit 458ccb0

File tree

3 files changed

+33
-5
lines changed

3 files changed

+33
-5
lines changed

cli/core/pkg/command/discovery_source.go

+5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import (
77
"fmt"
88
"strings"
99

10+
"github.com/aunum/log"
11+
1012
"github.com/pkg/errors"
1113
"github.com/spf13/cobra"
1214

@@ -129,6 +131,7 @@ var addDiscoverySourceCmd = &cobra.Command{
129131
if err != nil {
130132
return err
131133
}
134+
log.Successf("successfully added discovery source %s", discoverySourceName)
132135
return nil
133136
},
134137
}
@@ -175,6 +178,7 @@ var updateDiscoverySourceCmd = &cobra.Command{
175178
if err != nil {
176179
return err
177180
}
181+
log.Successf("updated discovery source %s", discoveryName)
178182
return nil
179183
},
180184
}
@@ -211,6 +215,7 @@ var deleteDiscoverySourceCmd = &cobra.Command{
211215
if err != nil {
212216
return err
213217
}
218+
log.Successf("deleted discovery source %s", discoveryName)
214219
return nil
215220
},
216221
}

cli/core/pkg/command/plugin_manager.go

+23-5
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,11 @@ var upgradePluginCmd = &cobra.Command{
366366

367367
versionSelector := repo.VersionSelector()
368368
err = cli.UpgradePlugin(pluginName, plugin.FindVersion(versionSelector), repo)
369-
return
369+
if err != nil {
370+
return err
371+
}
372+
log.Successf("successfully upgraded plugin %s", pluginName)
373+
return nil
370374
},
371375
}
372376

@@ -402,8 +406,11 @@ var deletePluginCmd = &cobra.Command{
402406
}
403407

404408
err = cli.DeletePlugin(pluginName)
405-
406-
return
409+
if err != nil {
410+
return err
411+
}
412+
log.Successf("successfully deleted plugin %s", pluginName)
413+
return nil
407414
},
408415
}
409416

@@ -412,9 +419,20 @@ var cleanPluginCmd = &cobra.Command{
412419
Short: "Clean the plugins",
413420
RunE: func(cmd *cobra.Command, args []string) (err error) {
414421
if config.IsFeatureActivated(config.FeatureContextAwareCLIForPlugins) {
415-
return pluginmanager.Clean()
422+
err = pluginmanager.Clean()
423+
if err != nil {
424+
return err
425+
}
426+
log.Success("successfully cleaned up all plugins")
427+
return nil
416428
}
417-
return cli.Clean()
429+
430+
err = cli.Clean()
431+
if err != nil {
432+
return err
433+
}
434+
log.Success("successfully cleaned up all plugins")
435+
return nil
418436
},
419437
}
420438

cli/core/pkg/command/repo.go

+5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ package command
66
import (
77
"fmt"
88

9+
"github.com/aunum/log"
10+
911
"github.com/spf13/cobra"
1012

1113
configv1alpha1 "github.com/vmware-tanzu/tanzu-framework/apis/config/v1alpha1"
@@ -104,6 +106,7 @@ var addRepoCmd = &cobra.Command{
104106
if err != nil {
105107
return err
106108
}
109+
log.Successf("successfully added repository %s", pluginRepo.GCPPluginRepository.Name)
107110
return nil
108111
},
109112
}
@@ -152,6 +155,7 @@ var updateRepoCmd = &cobra.Command{
152155
if err != nil {
153156
return err
154157
}
158+
log.Successf("successfully updated repository configuration for %s", repoName)
155159
return nil
156160
},
157161
}
@@ -191,6 +195,7 @@ var deleteRepoCmd = &cobra.Command{
191195
if err != nil {
192196
return err
193197
}
198+
log.Successf("successfully deleted repository %s", repoName)
194199
return nil
195200
},
196201
}

0 commit comments

Comments
 (0)