@@ -46,7 +46,7 @@ func (e *Executor) loadPlugins(ctx context.Context, cfg *config.Project) error {
4646 pluginsToDownload := make (map [int ]* config.Plugin )
4747
4848 for i , plug := range cfg .Plugins {
49- plugin , err := e .loader .LoadPlugin (plug .Name , plug .Source , plug .VerRange (), cfg .PluginLock (plug ))
49+ plugin , err := e .loader .LoadPlugin (ctx , plug .Name , plug .Source , plug .VerRange (), cfg .PluginLock (plug ))
5050 if err != nil {
5151 if err != plugins .ErrPluginNotFound {
5252 return err
@@ -58,22 +58,26 @@ func (e *Executor) loadPlugins(ctx context.Context, cfg *config.Project) error {
5858 }
5959
6060 plugs [i ] = plugin
61+
62+ plug .SetLoaded (plugin )
6163 }
6264
6365 if len (pluginsToDownload ) != 0 {
64- prog , _ := e .log .ProgressBar ().WithTotal (len (pluginsToDownload )).WithTitle ("Downloading plugins" ).Start ()
66+ prog , _ := e .log .ProgressBar ().WithTotal (len (pluginsToDownload )).WithTitle ("Downloading plugins... " ).Start ()
6567
6668 for i , plug := range pluginsToDownload {
67- prog . Title = fmt .Sprintf ("Downloading plugin '%s'" , plug .Name )
69+ title : = fmt .Sprintf ("Downloading plugin '%s'" , plug .Name )
6870 if plug .Version != "" {
69- prog . Title += fmt .Sprintf (" with version: %s" , plug .Version )
71+ title += fmt .Sprintf (" with version: %s" , plug .Version )
7072 }
7173
72- prog .Add ( 0 ) // force title update
74+ prog .UpdateTitle ( title )
7375
7476 plugin , err := e .loader .DownloadPlugin (ctx , plug .Name , plug .VerRange (), plug .Source , cfg .PluginLock (plug ))
7577 plugs [i ] = plugin
7678
79+ plug .SetLoaded (plugin )
80+
7781 if err != nil {
7882 _ , _ = prog .Stop ()
7983
@@ -83,8 +87,6 @@ func (e *Executor) loadPlugins(ctx context.Context, cfg *config.Project) error {
8387 prog .Increment ()
8488 pterm .Success .Printf ("Downloaded plugin '%s' at version: %s\n " , plug .Name , plugin .Version )
8589 }
86-
87- _ , _ = prog .Stop ()
8890 }
8991
9092 // Normalize and start plugins.
@@ -104,7 +106,7 @@ func (e *Executor) loadPlugins(ctx context.Context, cfg *config.Project) error {
104106 }
105107 }
106108
107- cfg .SetPlugins (plugs )
109+ cfg .SetLoadedPlugins (plugs )
108110
109111 return nil
110112}
0 commit comments