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

Update bash-completion for bidirectional "docker cp" #6

Merged
merged 1 commit into from
Jun 25, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions contrib/completion/bash/docker
Original file line number Diff line number Diff line change
Expand Up @@ -196,25 +196,21 @@ _docker_commit()
_docker_cp()
{
local counter=$(__docker_pos_first_nonflag)
if [ $cword -eq $counter ]; then
if [ $cword -eq $counter -o $cword -eq $(( counter + 1 )) ]; then
case "$cur" in
*:)
*:*)
# TODO somehow do _filedir for stuff inside the container
return
;;
*)
__docker_containers_all
COMPREPLY=( $( compgen -W "${COMPREPLY[*]}" -S ':' ) )
compopt -o nospace
_filedir
return
;;
esac
fi
(( counter++ ))

if [ $cword -eq $counter ]; then
_filedir
return
fi
}

_docker_diff()
Expand Down