evanlucas / fish-kubectl-completions

kubectl completions for fish shell
MIT License
576 stars 42 forks source link

Add context support #10

Closed mildebrandt closed 4 years ago

mildebrandt commented 6 years ago

We have over 10 clusters in our kube config files. Instead of switching the default context each time, we just use the --context switch to choose the cluster to work on.

ohechtl commented 5 years ago

I've tried this with a command like:

 kubectl --context=context -n namespace logs <tab>

but it only says that:

The connection to the server localhost:8080 was refused - did you specify the right host or port?

Did I miss something?

mildebrandt commented 5 years ago

Ah, I've never used an equals sign between the parameter and the value...only a space. I'll look into covering that usage later today or tomorrow. For now, you should see the correct behavior when you use a space.

mildebrandt commented 5 years ago

I've added support for the --context=<context name> syntax.

ohechtl commented 5 years ago

Cool, thanks for the quick response and fix! I didn't know about the other syntax you used, but it now works for both :+1:

evanlucas commented 5 years ago

This looks good. Thanks for taking the time to do this. I have recently switched this over to being auto generated based on the actual kubectl codebase. Can you add these changes to https://github.com/evanlucas/fish-kubectl-completions/blob/master/main.go#L23-L25 as well?

evanlucas commented 4 years ago

I went ahead and added this in https://github.com/evanlucas/fish-kubectl-completions/commit/09c1e7e4803bb5b3a16dd209d3663207579bf6de. @mildebrandt, thanks for the contribution. I hope it's okay that I gave attribution via the Co-authored-by metadata in the commit message.

mildebrandt commented 4 years ago

Thanks, sorry I didn’t get that last piece you asked for. I switched jobs around that time and was getting up to speed there. I’m also not using kubernetes in my new role, and I forgot about this PR. Hopefully it’s useful for others.