mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-11 15:12:47 +09:00
simple plugin search
This commit is contained in:
@@ -118,6 +118,19 @@ func PluginCmd(args []string) {
|
||||
}
|
||||
case "update":
|
||||
UpdatePlugins()
|
||||
case "search":
|
||||
searchText := strings.Join(args[1:], " ")
|
||||
plugins := SearchPlugin(searchText)
|
||||
messenger.Message(len(plugins), " plugins found")
|
||||
for _, p := range plugins {
|
||||
messenger.AddLog("\n")
|
||||
messenger.AddLog(p.String())
|
||||
}
|
||||
if len(plugins) > 0 {
|
||||
if CurView().Type != vtLog {
|
||||
ToggleLog([]string{})
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
messenger.Error("Not enough arguments")
|
||||
|
||||
@@ -71,6 +71,22 @@ type PluginDependency struct {
|
||||
// PluginDependencies is a slice of PluginDependency
|
||||
type PluginDependencies []*PluginDependency
|
||||
|
||||
func (pp *PluginPackage) String() string {
|
||||
buf := new(bytes.Buffer)
|
||||
buf.WriteString("Plugin: ")
|
||||
buf.WriteString(pp.Name)
|
||||
buf.WriteRune('\n')
|
||||
if pp.Author != "" {
|
||||
buf.WriteString("Author: ")
|
||||
buf.WriteString(pp.Author)
|
||||
buf.WriteRune('\n')
|
||||
}
|
||||
if pp.Description != "" {
|
||||
buf.WriteString(pp.Description)
|
||||
}
|
||||
return buf.String()
|
||||
}
|
||||
|
||||
func fetchAllSources(count int, fetcher func(i int) PluginPackages) PluginPackages {
|
||||
wgQuery := new(sync.WaitGroup)
|
||||
wgQuery.Add(count)
|
||||
|
||||
Reference in New Issue
Block a user