-
Notifications
You must be signed in to change notification settings - Fork 290
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
Added '@Botkube commands list' to show all the supported kubectl cmds #328
Conversation
@girishg4t Could you please add this screenshot of command response here? |
pkg/execute/executor.go
Outdated
@@ -146,6 +149,14 @@ const ( | |||
FilterDisable FiltersAction = "disable" | |||
) | |||
|
|||
// InfoAction for options in Info commands | |||
type InfoAction string |
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.
Let's not export InfoAction
type if not needed
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.
corrected InfoAction
to infoAction
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.
The output of the command is
allowed verbs:
- cluster-info
- diff
- get
- api-resources
- api-versions
- describe
- explain
- logs
- top
- auth
allowed resources:
- storageclasses
- nodes
- deployments
- pods
- namespaces
- daemonsets
- statefulsets
pkg/utils/utils.go
Outdated
@@ -477,3 +479,15 @@ func GetClusterNameFromKubectlCmd(cmd string) string { | |||
} | |||
return s | |||
} | |||
|
|||
//GetFormatedCommandsList get the formated commands list | |||
func GetFormatedCommandsList(header string, commands map[string]bool) string { |
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.
Please use generic name for the function. It feels that this func is specifically for command list only
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.
corrected name to GetStingInYamlFormat
, pls suggest
test/e2e/command/botkube.go
Outdated
@@ -90,6 +115,7 @@ func (c *context) testBotkubeCommand(t *testing.T) { | |||
|
|||
func compareFilters(expected, actual []string) bool { | |||
if len(expected) != len(actual) { | |||
log.Infof("************************Expected %d Actual %d", len(expected), len(actual)) |
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.
Please remove the debug logs
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.
Removed
ISSUE TYPE
SUMMARY
Added new botkube command to list all the supported commands, @botkube commands list
Below are the changes
made changes in executor.go to handle newly added command
added common method in utils.go to format the allowed commands
Fixes #312