Provide a -usage flag for printing the usage of a single plugin
Closes #136
This commit is contained in:
12
config.go
12
config.go
@@ -421,3 +421,15 @@ func PrintSampleConfig() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PrintPluginConfig prints the config usage of a single plugin.
|
||||
func PrintPluginConfig(name string) error {
|
||||
if creator, ok := plugins.Plugins[name]; ok {
|
||||
plugin := creator()
|
||||
fmt.Printf("# %s\n[%s]\n", plugin.Description(), name)
|
||||
fmt.Printf(strings.TrimSpace(plugin.SampleConfig()))
|
||||
} else {
|
||||
return errors.New(fmt.Sprintf("Plugin %s not found", name))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user