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

Introduce completion #470

Merged
merged 3 commits into from
Nov 1, 2022
Merged

Introduce completion #470

merged 3 commits into from
Nov 1, 2022

Conversation

d-kuro
Copy link
Collaborator

@d-kuro d-kuro commented Oct 19, 2022

refs: #354

📝

Completion is currently not available via kubectl plugin.

ref: kubernetes/kubernetes#105867

Introduce completion for kubectl-moco.
The completion subcommand is now available by default in cobra.

$ kubectl-moco -h
the utility command for MOCO.

Usage:
  kubectl-moco [command]

Available Commands:
  completion  Generate the autocompletion script for the specified shell
<snip>

Subcommand completion is currently available.

$ kubectl-moco [tab]
-- completions --
completion  -- Generate the autocompletion script for the specified shell
credential  -- Fetch the credential of a specified user
help        -- Help about any command
mysql       -- Run mysql command in a specified MySQL instance
switchover  -- Switch the primary instance

This PR enables cluster name completion and flag completion.

e.g.

$ kubectl-moco mysql -n foo [tab]
-- completions --
test

$ kubectl-moco credential --format [tab]
-- completions --
mycnf  plain

Signed-off-by: d-kuro <kurosawa7620@gmail.com>
@d-kuro d-kuro requested a review from masa213f October 19, 2022 01:49
@d-kuro d-kuro self-assigned this Oct 19, 2022
@d-kuro d-kuro marked this pull request as ready for review October 19, 2022 01:50
cmd/kubectl-moco/cmd/credential.go Outdated Show resolved Hide resolved
cmd/kubectl-moco/cmd/credential.go Show resolved Hide resolved
Signed-off-by: d-kuro <kurosawa7620@gmail.com>
Signed-off-by: d-kuro <kurosawa7620@gmail.com>
@d-kuro d-kuro requested a review from masa213f October 25, 2022 20:06
Copy link
Contributor

@masa213f masa213f left a comment

Choose a reason for hiding this comment

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

LGTM

@masa213f masa213f merged commit 416990f into main Nov 1, 2022
@masa213f masa213f deleted the d-kuro/completion branch November 1, 2022 05:01
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.

None yet

2 participants