Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Enhancement: publish keyspace as part of plugin help #40

Open
jspaleta opened this issue Aug 26, 2020 · 2 comments
Open

Feature Enhancement: publish keyspace as part of plugin help #40

jspaleta opened this issue Aug 26, 2020 · 2 comments

Comments

@jspaleta
Copy link
Contributor

jspaleta commented Aug 26, 2020

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.

@nikkictl
Copy link

nikkictl commented Sep 1, 2020

@jspaleta can you provide an example use case for this suggestion?

@jspaleta
Copy link
Contributor Author

jspaleta commented Sep 2, 2020

Straw use case example (slack handler):

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.

Updated usage for the slack handler would look something like this:

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.
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants