Skip to content

Commit

Permalink
chore: improve update --all output format
Browse files Browse the repository at this point in the history
  • Loading branch information
aooohan committed Apr 21, 2024
1 parent 804e782 commit 5e0040d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
8 changes: 7 additions & 1 deletion cmd/commands/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,15 @@ func updateCmd(ctx *cli.Context) error {
defer manager.Close()
if ctx.Bool(allFlag) {
if sdks, err := manager.LoadAllSdk(); err == nil {
var (
index int
total = len(sdks)
)
for sdk := range sdks {
index++
pterm.Printf("[%s/%d]: Updating %s plugin...\n", pterm.Green(index), total, pterm.Green(sdk))
if err = manager.Update(sdk); err != nil {
pterm.Println(fmt.Sprintf("update plugin(%s) failed, %s", sdk, err.Error()))
pterm.Println(fmt.Sprintf("Update plugin(%s) failed, %s", sdk, err.Error()))
}
}
} else {
Expand Down
8 changes: 0 additions & 8 deletions internal/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,14 +384,6 @@ func (m *Manager) downloadPlugin(downloadUrl string) (string, error) {
return path, nil
}

func (m *Manager) pluginExist(name, alias string) bool {
pname := name
if len(alias) > 0 {
pname = alias
}
return util.FileExists(filepath.Join(m.PathMeta.PluginPath, pname))
}

// Add a plugin to plugin home directory
// 1. If the plugin is an official plugin, fetch the plugin manifest from the registry.
// 2. If the plugin is a custom plugin, install the plugin from the specified URL.
Expand Down

0 comments on commit 5e0040d

Please sign in to comment.