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

Added '@Botkube commands list' to show all the supported kubectl cmds #328

Merged
merged 9 commits into from
Sep 2, 2020

Conversation

girishg4t
Copy link
Contributor

ISSUE TYPE
  • Feature Pull Request
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

@PrasadG193
Copy link
Collaborator

@girishg4t Could you please add this screenshot of command response here?

@@ -146,6 +149,14 @@ const (
FilterDisable FiltersAction = "disable"
)

// InfoAction for options in Info commands
type InfoAction string
Copy link
Collaborator

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

corrected InfoAction to infoAction

Copy link
Contributor Author

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

@@ -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 {
Copy link
Collaborator

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

Copy link
Contributor Author

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

@@ -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))
Copy link
Collaborator

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

@girishg4t girishg4t changed the title New command Added '@botkube commands list' to show all the kubectl supported cmds Aug 24, 2020
@girishg4t girishg4t changed the title Added '@botkube commands list' to show all the kubectl supported cmds Added '@Botkube commands list' to show all the kubectl supported cmds Aug 24, 2020
@girishg4t girishg4t changed the title Added '@Botkube commands list' to show all the kubectl supported cmds Added '@Botkube commands list' to show all the supported kubectl cmds Aug 27, 2020
pkg/execute/executor.go Outdated Show resolved Hide resolved
pkg/utils/utils.go Outdated Show resolved Hide resolved
@mergify mergify bot merged commit ae980c7 into develop Sep 2, 2020
@mergify mergify bot deleted the newCommand branch September 2, 2020 04:52
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

Successfully merging this pull request may close these issues.

New BotKube command to list the supported kubectl cmds
3 participants