Bug 1418457 - OC binaries on customer portal should ship with bash completion scripts
Summary: OC binaries on customer portal should ship with bash completion scripts
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Installer
Version: 3.5.0
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: ---
: ---
Assignee: Scott Dodson
QA Contact: Johnny Liu
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-02-01 21:34 UTC by Eric Rich
Modified: 2018-09-04 20:12 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-09-04 20:09:24 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Eric Rich 2017-02-01 21:34:54 UTC
Description of problem:

The oc tar file on the customer portal should ship with the bash completion scripts, and a READ me on how to install them. 

With out this you have to do something like: 

sudo curl -o /etc/bash_completion.d/oc https://raw.githubusercontent.com/openshift/origin/master/contrib/completions/bash/oc

Comment 1 Scott Dodson 2017-02-01 21:38:16 UTC
Re-assigning to CLI team, I think there's a way to install completions using the oc binary but I'm not familiar with it. If possible it'd be nice for the binary to do this automatically if possible or make it glaringly obvious how to do it when completions aren't installed.

Comment 2 Jessica Forrester 2017-02-02 14:55:04 UTC
There is an easy way to install bash completions using oc, @jvallejo will add a comment to explain, because of that I'm lowering sev.  We might consider adding info to oc help if we can detect completions aren't installed.  Not sure we should go so far as 'oc' automatically installing completions when it sees they aren't there.

Comment 3 Juan Vallejo 2017-02-02 15:01:04 UTC
There is currently a way to install completions just using the oc binary by sourcing the output of "$oc completion <SHELL_NAME>". Although only bash and zsh are supported at the moment, a user can install completions by sourcing the output of this command:

$ source <(oc completion bash)

This must be done every time a new shell is opened, but could definitely be added to .bashrc to solve this:

$ echo "source <(oc completion bash)" >> ~/.bashrc
or 
$ echo "source <(oc completion zsh)" >> ~/.zshrc

"oc completion -h" contains some examples and further instructions that guides a user on adding completion support to bash in general when running in older versions of bash.

Comment 4 Juan Vallejo 2017-02-10 22:32:45 UTC
Maybe we could add a note in the output of `oc -h` that prompts the user to see `oc completion -h` for help on installing completions?

Comment 5 Juan Vallejo 2018-09-04 14:52:08 UTC
Moving this to the installer team. We would need to source the output of `oc completion bash` as part of the install process for the `oc` binary.

Comment 6 Scott Dodson 2018-09-04 20:09:24 UTC
/etc/bash_completion.d/oc is already deployed whenever the installer is used by way of the atomic-openshift-clients package.


Note You need to log in before you can comment on or make changes to this bug.