@@ -42,6 +42,7 @@ type PluginPackage struct {
4242 Author string
4343 Tags []string
4444 Versions PluginVersions
45+ Default bool
4546}
4647
4748// PluginPackages is a list of PluginPackage instances.
@@ -75,6 +76,9 @@ func (pp *PluginPackage) String() string {
7576 buf := new (bytes.Buffer )
7677 buf .WriteString ("Plugin: " )
7778 buf .WriteString (pp .Name )
79+ if pp .Default {
80+ buf .WriteString (" (built-in)" )
81+ }
7882 buf .WriteRune ('\n' )
7983 if pp .Author != "" {
8084 buf .WriteString ("Author: " )
@@ -334,7 +338,7 @@ func isUnknownCoreVersion() bool {
334338 return err != nil
335339}
336340
337- func newStaticPluginVersion (name , version string ) * PluginVersion {
341+ func newStaticPluginVersion (name , version string , builtin bool ) * PluginVersion {
338342 vers , err := semver .ParseTolerant (version )
339343
340344 if err != nil {
@@ -343,7 +347,8 @@ func newStaticPluginVersion(name, version string) *PluginVersion {
343347 }
344348 }
345349 pl := & PluginPackage {
346- Name : name ,
350+ Name : name ,
351+ Default : builtin ,
347352 }
348353 pv := & PluginVersion {
349354 pack : pl ,
@@ -358,15 +363,15 @@ func newStaticPluginVersion(name, version string) *PluginVersion {
358363func GetInstalledVersions (withCore bool ) PluginVersions {
359364 result := PluginVersions {}
360365 if withCore {
361- result = append (result , newStaticPluginVersion (CorePluginName , util .Version ))
366+ result = append (result , newStaticPluginVersion (CorePluginName , util .Version , true ))
362367 }
363368
364369 for _ , p := range Plugins {
365370 if ! p .IsLoaded () {
366371 continue
367372 }
368373 version := GetInstalledPluginVersion (p .Name )
369- if pv := newStaticPluginVersion (p .Name , version ); pv != nil {
374+ if pv := newStaticPluginVersion (p .Name , version , p . Default ); pv != nil {
370375 result = append (result , pv )
371376 }
372377 }
@@ -613,7 +618,7 @@ func UpdatePlugins(out io.Writer, plugins []string) {
613618
614619 fmt .Fprintln (out , "Checking for plugin updates" )
615620 microVersion := PluginVersions {
616- newStaticPluginVersion (CorePluginName , util .Version ),
621+ newStaticPluginVersion (CorePluginName , util .Version , true ),
617622 }
618623
619624 var updates = make (PluginDependencies , 0 )
@@ -687,7 +692,13 @@ func PluginCommand(out io.Writer, cmd string, args []string) {
687692 plugins := GetInstalledVersions (false )
688693 fmt .Fprintln (out , "The following plugins are currently installed:" )
689694 for _ , p := range plugins {
690- fmt .Fprintf (out , "%s (%s)\n " , p .Pack ().Name , p .Version )
695+ var pluginname string
696+ if p .Pack ().Default {
697+ pluginname = p .Pack ().Name + " (built-in)"
698+ } else {
699+ pluginname = p .Pack ().Name
700+ }
701+ fmt .Fprintf (out , "%s (%s)\n " , pluginname , p .Version )
691702 }
692703 case "search" :
693704 plugins := SearchPlugin (out , args )
0 commit comments