@@ -43,6 +43,7 @@ type PluginPackage struct {
4343 Author string
4444 Tags []string
4545 Versions PluginVersions
46+ Default bool
4647}
4748
4849// PluginPackages is a list of PluginPackage instances.
@@ -76,6 +77,9 @@ func (pp *PluginPackage) String() string {
7677 buf := new (bytes.Buffer )
7778 buf .WriteString ("Plugin: " )
7879 buf .WriteString (pp .Name )
80+ if pp .Default {
81+ buf .WriteString (" (built-in)" )
82+ }
7983 buf .WriteRune ('\n' )
8084 if pp .Author != "" {
8185 buf .WriteString ("Author: " )
@@ -341,7 +345,7 @@ func isUnknownCoreVersion() bool {
341345 return err != nil
342346}
343347
344- func newStaticPluginVersion (name , version string ) * PluginVersion {
348+ func newStaticPluginVersion (name , version string , builtin bool ) * PluginVersion {
345349 vers , err := semver .ParseTolerant (version )
346350
347351 if err != nil {
@@ -350,7 +354,8 @@ func newStaticPluginVersion(name, version string) *PluginVersion {
350354 }
351355 }
352356 pl := & PluginPackage {
353- Name : name ,
357+ Name : name ,
358+ Default : builtin ,
354359 }
355360 pv := & PluginVersion {
356361 pack : pl ,
@@ -365,15 +370,15 @@ func newStaticPluginVersion(name, version string) *PluginVersion {
365370func GetInstalledVersions (withCore bool ) PluginVersions {
366371 result := PluginVersions {}
367372 if withCore {
368- result = append (result , newStaticPluginVersion (CorePluginName , util .Version ))
373+ result = append (result , newStaticPluginVersion (CorePluginName , util .Version , true ))
369374 }
370375
371376 for _ , p := range Plugins {
372377 if ! p .IsLoaded () {
373378 continue
374379 }
375380 version := GetInstalledPluginVersion (p .Name )
376- if pv := newStaticPluginVersion (p .Name , version ); pv != nil {
381+ if pv := newStaticPluginVersion (p .Name , version , p . Default ); pv != nil {
377382 result = append (result , pv )
378383 }
379384 }
@@ -623,7 +628,7 @@ func UpdatePlugins(out io.Writer, plugins []string) {
623628
624629 fmt .Fprintln (out , "Checking for plugin updates" )
625630 microVersion := PluginVersions {
626- newStaticPluginVersion (CorePluginName , util .Version ),
631+ newStaticPluginVersion (CorePluginName , util .Version , true ),
627632 }
628633
629634 var updates = make (PluginDependencies , 0 )
@@ -699,7 +704,13 @@ func PluginCommand(out io.Writer, cmd string, args []string) {
699704 plugins := GetInstalledVersions (false )
700705 fmt .Fprintln (out , "The following plugins are currently installed:" )
701706 for _ , p := range plugins {
702- fmt .Fprintf (out , "%s (%s)\n " , p .Pack ().Name , p .Version )
707+ var pluginname string
708+ if p .Pack ().Default {
709+ pluginname = p .Pack ().Name + " (built-in)"
710+ } else {
711+ pluginname = p .Pack ().Name
712+ }
713+ fmt .Fprintf (out , "%s (%s)\n " , pluginname , p .Version )
703714 }
704715 case "search" :
705716 fmt .Fprintln (out , "Fetching plugins, please wait..." )
0 commit comments