Skip to content

Commit 0be638a

Browse files
authored
feat: animate plugin install operations with CLIProgress spinners (#286)
Wrap the network-backed plugin installs in progress spinners matching the doctor/preflight pattern: plugin install (GitHub) shows 'Installing plugin from GitHub', and plugin marketplace install shows 'Fetching plugin' then 'Installing plugin'. Non-TTY renders clean static lines.
1 parent 2b8bf14 commit 0be638a

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

‎cmd/plugin_dynamic.go‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,14 @@ var pluginInstallDynamicCmd = &cobra.Command{
140140

141141
// Otherwise treat as GitHub repo
142142
dm := getDynamicManager()
143+
prog := NewCLIProgress("Plugin install", []string{"Installing plugin from GitHub"})
144+
prog.StartStep(0)
143145
if err := dm.InstallFromGitHub(source); err != nil {
146+
prog.Abort()
144147
return err
145148
}
149+
prog.CompleteStep(0)
150+
prog.Done()
146151
cmd.Printf("%s\n", auditTint("Installed plugin from "+source+".", doneGreen))
147152

148153
// Re-discover
@@ -452,14 +457,22 @@ var pluginMarketplaceInstallCmd = &cobra.Command{
452457
Args: cobra.ExactArgs(1),
453458
RunE: func(cmd *cobra.Command, args []string) error {
454459
mc := plugin.NewMarketplaceClient()
460+
prog := NewCLIProgress("Plugin install", []string{"Fetching plugin", "Installing plugin"})
461+
prog.StartStep(0)
455462
entry, err := mc.Find(args[0])
456463
if err != nil {
464+
prog.Abort()
457465
return err
458466
}
467+
prog.CompleteStep(0)
468+
prog.StartStep(1)
459469
dir, err := mc.Install(*entry)
460470
if err != nil {
471+
prog.Abort()
461472
return err
462473
}
474+
prog.CompleteStep(1)
475+
prog.Done()
463476
cmd.Printf("%s\n", auditTint("Installed "+entry.Name+" to ", doneGreen)+auditTint(dir, textPrimary))
464477
// re-discover
465478
_ = getDynamicManager().DiscoverAll()

0 commit comments

Comments
 (0)