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

Auto completion for the plugin #70

Open
subhamkrai opened this issue Oct 28, 2022 · 7 comments
Open

Auto completion for the plugin #70

subhamkrai opened this issue Oct 28, 2022 · 7 comments

Comments

@subhamkrai
Copy link
Collaborator

With this pr kubernetes/kubernetes#105867 which is supposed to present in kubectl v1.26 which will support krew plugins auto-completion. It will be good to have this in our plugin.

@crabique
Copy link

crabique commented Jun 7, 2023

Does this imply completions on kubectl-command level (namespaces etc) or for subcommands as well, e.g. for rook-ceph rbd?

@subhamkrai
Copy link
Collaborator Author

@crabique Currently, auto-completion is not supported in rook-ceph plugin. But we'll support this soon

@obnoxxx
Copy link
Contributor

obnoxxx commented Oct 18, 2023

@subhamkrai , in my local build, the build already has a completion command:

$ ./bin/kubectl-rook-ceph           
kubectl rook-ceph provides common management and troubleshooting tools for Ceph.

Usage:
  rook-ceph [command]

Available Commands:
  ceph            call a 'ceph' CLI command with arbitrary args
  completion      Generate the autocompletion script for the specified shell
  debug           Debug a deployment by scaling it down and creating a debug copy. This is supported for mons and OSDs only
 
$  ./bin/kubectl-rook-ceph completion
Generate the autocompletion script for rook-ceph for the specified shell.
See each sub-command's help for details on how to use the generated script.

Usage:
  rook-ceph completion [command]

Available Commands:
  bash        Generate the autocompletion script for bash
  fish        Generate the autocompletion script for fish
  powershell  Generate the autocompletion script for powershell
  zsh         Generate the autocompletion script for zsh

Flags:
  -h, --help   help for completion

Global Flags:
      --context string              Kubernetes context to use
      --kubeconfig string           kubernetes config path
  -n, --namespace string            Kubernetes namespace where CephCluster is created (default "rook-ceph")
      --operator-namespace string   Kubernetes namespace where rook operator is running

Use "rook-ceph completion [command] --help" for more information about a command.

maybe we have picked it up via an update of the kubernetes dependency automatically?

@subhamkrai
Copy link
Collaborator Author

@obnoxxx what we're looking with the issue to get auto completion support kubectl for kubectl plugins which currently not available.

What you have shared is coming from the go command line, using go today also we can have auto-completion that will work when directly using the binary.

@obnoxxx
Copy link
Contributor

obnoxxx commented Oct 19, 2023

@subhamkrai I tried it locally and I can confirm that it currently works for neither the locally bilt kubectl-rook-ceph binary nor for the installed plugin kubectl rook-ceph

I am not quite sure yet what needs to be done to really enable it.

@Skaronator
Copy link

Unless I'm missing something: The auto-completion currently requires a configured rook which doesn't seem ideal:

kubectl rook-ceph completion bash                                                                                                                                                                                                 
Error: operator namespace 'rook-ceph' does not exist. namespaces "rook-ceph" not found

@subhamkrai
Copy link
Collaborator Author

@Skaronator I did auto-complete a long time back but only with local binary. But the auto-completion is not supported in krew yet.

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

No branches or pull requests

4 participants