-
Notifications
You must be signed in to change notification settings - Fork 263
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
fixes(#814) allow plugins to extend the 'source' command group #818
Changes from all commits
7b488df
fdcd206
6ed686f
3b0fe24
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,3 +52,20 @@ func BindPluginsFlagToViper(cmd *cobra.Command) { | |
viper.SetDefault("plugins-dir", commands.Cfg.DefaultPluginDir) | ||
viper.SetDefault("lookup-plugins", false) | ||
} | ||
|
||
// AllowedExtensibleCommandGroups the list of command groups that can be | ||
// extended with plugins, e.g., a plugin named `kn-source-kafka` for Kafka | ||
// event sources is allowed. This is defined as a fixed [...]string since | ||
// cannot defined Golang []string constants | ||
var AllowedExtensibleCommandGroups = [...]string{"source"} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure about that since we would not want extensions of core commands There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. as per today’s discussion, please merge this PR and I will open an issue with your suggestion with more details and open a 24 hours vote. Thanks @navidshaikh and @rhuss |
||
|
||
// InAllowedExtensibleCommandGroups checks that the name is in the list of allowed | ||
// extensible command groups | ||
func InAllowedExtensibleCommandGroups(name string) bool { | ||
for _, groupName := range AllowedExtensibleCommandGroups { | ||
if name == groupName { | ||
return true | ||
} | ||
} | ||
return false | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this also verify the plugin name from the returned list ?