Open jspaleta opened 4 years ago
@jspaleta can you provide an example use case for this suggestion?
Sensu slack handler currently defines a keyspace but its only documented in the readme..
It would be very useful if there was a note in the usage message for all plugins that have a Keyspace defined, indicated what the keyspace is, and if possible which arguments have a keyspace PATH defined. Not all arguments are keyspaced. Path strings associated with PluginConfigOption aren't discoverable from the Argument name.
The Sensu Go Slack handler for notifying a channel
Usage:
sensu-slack-handler [flags]
sensu-slack-handler [command]
Available Commands:
help Help about any command
version Print the version number of this plugin
Flags:
-c, --channel string The channel to post messages to (default "#general")
-t, --description-template string The Slack notification output template, in Golang text/template format (default "{{ .Check.Output }}")
-h, --help help for sensu-slack-handler
-i, --icon-url string A URL to an image to use as the user avatar (default "https://www.sensu.io/img/sensu-logo.png")
-u, --username string The username that messages will be sent as (default "sensu")
-w, --webhook-url string The webhook url to send messages to
Annotation Keyspace: "sensu.io/plugins/slack/config/<parameter>"
Keyspace active for the following parameters:
webHookURL,
channel,
username,
iconURL,
descriptionTemplate
Use "sensu-slack-handler [command] --help" for more information about a command.
`
Make it possible for the sdk to communicate the keyspace in the help message.
Straw proposal:
override the cobra.command default HelpFunction with a custom function that appends a Keyspace usage string into the the help output.