sensu / sensu-plugin-sdk

A framework for creating Sensu plugins
MIT License
7 stars 8 forks source link

Add support for cobra StringArray #73

Closed echlebek closed 2 years ago

echlebek commented 2 years ago

This commit adds support to SlicePluginConfigOption for using cobra StringArray, when the type parameter is string. Other types of lists are not supported by cobra. The behaviour is enabled by setting the UseCobraStringArray field true.

This option is useful when developers want to support lists of values, but want to consider values like "1,2" or "1 2" as a single value.

This work is a take on https://github.com/sensu/sensu-plugin-sdk/pull/55, updated to reflect the recent changes to the plugin SDK.

Signed-off-by: Eric Chlebek eric@sensu.io