with about plugins

This commit is contained in:
2022-11-02 22:10:15 +01:00
parent e59a87c43a
commit c6fd666f64
13 changed files with 250 additions and 46 deletions

View File

@@ -164,10 +164,32 @@ func (pr *PluginRegister) Close() error {
return nil
}
type CommandAboutItem struct {
Name string
Args []string
Required []string
}
type CommandAboutItems []*CommandAboutItem
func FromAboutCommands(commands []*AboutCommand) CommandAboutItems {
cai := make(CommandAboutItems, 0)
for _, command := range commands {
cai = append(cai, &CommandAboutItem{
Name: command.Name,
Args: command.Args,
Required: command.Required,
})
}
return cai
}
type AboutItem struct {
Name string
Version string
About string
Name string
Version string
About string
Vars []string
Commands CommandAboutItems
}
func (pr *PluginRegister) About(ctx context.Context) ([]AboutItem, error) {
@@ -184,9 +206,11 @@ func (pr *PluginRegister) About(ctx context.Context) ([]AboutItem, error) {
}
list = append(list, AboutItem{
Name: about.Name,
Version: about.Version,
About: about.About,
Name: about.Name,
Version: about.Version,
About: about.About,
Vars: about.Vars,
Commands: FromAboutCommands(about.Commands),
})
return nil
})