Skip to content

Commit f888a47

Browse files
authored
Merge pull request #43 from choria-io/33.3
(#33) allow the embedded name and help to be changed
2 parents 2fbd695 + 51b3fac commit f888a47

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Diff for: app_plugin.go

+9-2
Original file line numberDiff line numberDiff line change
@@ -280,14 +280,21 @@ func (a *Application) registerPluginModel(command string, model *ApplicationMode
280280
return cmd, nil
281281
}
282282

283-
// ExternalPluginCommand extends the application using a plugin and a model describing the application
284-
func (a *Application) ExternalPluginCommand(command string, model json.RawMessage) (*CmdClause, error) {
283+
// ExternalPluginCommand extends the application using a plugin and a model describing the application, when name or help is not an empty string it will override that from the plugin
284+
func (a *Application) ExternalPluginCommand(command string, model json.RawMessage, name string, help string) (*CmdClause, error) {
285285
var m ApplicationModel
286286
err := json.Unmarshal(model, &m)
287287
if err != nil {
288288
return nil, err
289289
}
290290

291+
if name != "" {
292+
m.Name = name
293+
}
294+
if help != "" {
295+
m.Help = help
296+
}
297+
291298
if m.Name == "" {
292299
return nil, fmt.Errorf("plugin declared no name")
293300
}

0 commit comments

Comments
 (0)