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

Add bash auto completion support #370

Merged
merged 1 commit into from
Jan 19, 2017

Conversation

cdrage
Copy link
Member

@cdrage cdrage commented Jan 9, 2017

Adds auto completion support that's generated via:

$ kompose complete

This file is added to /etc/bash_completion.d/kompose.sh

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jan 9, 2017
@cdrage
Copy link
Member Author

cdrage commented Jan 9, 2017

Closes #37

@coveralls
Copy link

Coverage Status

Coverage remained the same at 47.007% when pulling 15a1946 on cdrage:add-autocompletion into 2ba8831 on kubernetes-incubator:master.

Copy link
Contributor

@ngtuna ngtuna left a comment

Choose a reason for hiding this comment

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

Kompose should create the file if it's not exist.

./kompose completion
Error: open /etc/bash_completion.d/kompose.sh: no such file or directory

@cdrage
Copy link
Member Author

cdrage commented Jan 11, 2017

@ngtuna It should. Doesn't look like you're running as sudo / have user permission to /etc/bash_completion.d/

Try sudo ./kompose completion

@ngtuna
Copy link
Contributor

ngtuna commented Jan 11, 2017

Ah see it now... It doesn't work on Mac. Could we add this support to darwin ?

@surajssd
Copy link
Member

works on fedora for me 👍

@kadel
Copy link
Member

kadel commented Jan 12, 2017

Can we do it like kubectl or oc? Print to stdout instead to file? (https://kubernetes.io/docs/user-guide/kubectl/kubectl_completion/) or at least have option for it.

I don't think that it is no nice write to /etc by default without any warning.

I really like that stdout option, because if you put source <(kubectl completion bash) to you bashrc,
completion is always up to date, you don't have to remember regenerate it with new kubectl version

@kadel
Copy link
Member

kadel commented Jan 12, 2017

And one more. Some people are using ZSH (like me for example 😉 )

@cdrage
Copy link
Member Author

cdrage commented Jan 12, 2017

@kadel Alright :) I'll do these three things:

  1. Output to stdout
  2. Add the ZSH option (btw @kadel zsh > bash. #zshmasterrace)
  3. Add support for Darwin

@cdrage cdrage changed the title Add bash auto completion support [WIP] Add bash auto completion support Jan 12, 2017
@cdrage cdrage force-pushed the add-autocompletion branch 2 times, most recently from 0815dcc to 0107cc3 Compare January 13, 2017 15:37
@cdrage cdrage changed the title [WIP] Add bash auto completion support Add bash auto completion support Jan 13, 2017
@cdrage
Copy link
Member Author

cdrage commented Jan 13, 2017

@ngtuna @kadel

Ready for another review!

It now does:

  1. Outputs to stdout 👍
  2. Added bash support 👍
  3. For the users who use a laptop with a magical touchbar that removes the ESC key, you can simple source it with source <(kompose completion bash). 👍

Copy link
Member

@kadel kadel left a comment

Choose a reason for hiding this comment

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

👍
Tested ZSH and Bash on Linux, and just ZSH on MacOS

@cdrage cdrage force-pushed the add-autocompletion branch 2 times, most recently from 182e247 to cd40a1c Compare January 16, 2017 16:01
@cdrage
Copy link
Member Author

cdrage commented Jan 16, 2017

@kadel

Tests should be all green now (validate error with some unreachable code).

I've also updated the README with the appropriate instructions on how to use this!

Merge when you're ready 👍

Adds auto completion support that's generated via:
```
$ kompose complete
```

This file is added to /etc/bash_completion.d/kompose.sh
@kadel
Copy link
Member

kadel commented Jan 19, 2017

LGTM @ngtuna can you confirm?

@ngtuna
Copy link
Contributor

ngtuna commented Jan 19, 2017

Yes. Confirmed

@cdrage cdrage merged commit 94a9f88 into kubernetes:master Jan 19, 2017
@kadel kadel mentioned this pull request Feb 10, 2017
@cdrage cdrage deleted the add-autocompletion branch March 30, 2017 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants