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 completion command #213

Merged
merged 1 commit into from
Dec 13, 2017
Merged

Conversation

feiskyer
Copy link
Member

@feiskyer feiskyer commented Dec 6, 2017

For #212.

Note: only includes subcommands and global flags now. The completion for each subcommand is not included, need to figure out how to process it.

Generate shell completion code (works for both bash and zsh):

# crictl completion
_cli_bash_autocomplete() {
    local cur opts base
    COMPREPLY=()
    cur="${COMP_WORDS[COMP_CWORD]}"
    opts="attach
create
exec
version
images
inspect
inspecti
inspects
logs
port-forward
ps
pull
runs
rm
rmi
rms
sandboxes
start
info
stop
stops
update
config
stats
completion
help
h
--config
--debug
--image-endpoint
--runtime-endpoint
--timeout
--help
--version"
    COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
    return 0
}

complete -F _cli_bash_autocomplete crictl

Usage

source <(crictl completion)

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Dec 6, 2017
@feiskyer feiskyer requested a review from Random-Liu December 6, 2017 07:15
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Dec 6, 2017
@Random-Liu
Copy link
Contributor

@feiskyer
Copy link
Member Author

feiskyer commented Dec 7, 2017

@Random-Liu This PR works same way, but do not require users to source another autocomplete/bash_autocomplete file.

@feiskyer
Copy link
Member Author

ping @Random-Liu

@Random-Liu
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 13, 2017
@Random-Liu Random-Liu merged commit 0cc0c63 into kubernetes-sigs:master Dec 13, 2017
@feiskyer feiskyer deleted the completion branch December 13, 2017 04:51
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. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants