docker / libcompose

*Unmaintained/Deprecated* An experimental go library providing Compose-like functionality
https://godoc.org/github.com/docker/libcompose
Apache License 2.0
585 stars 191 forks source link

Support Bash Completion #100

Open bohai opened 8 years ago

bohai commented 8 years ago

This idea is to add bash completion for libcompose.

Below is a bash completion example:


// press tab twice after input "docker k", "kill" is completed and containers are printed.
root@SZX1000041895:~/sleep# docker ps
CONTAINER ID        IMAGE                        COMMAND             CREATED             STATUS              PORTS               NAMES
d3b5210874af        mbrt/golang-vim-dev:latest   "/bin/bash"         2 days ago          Up 2 days                               myvim

root@SZX1000041895:~/sleep# docker kill
d3b5210874af9c4d9fe9041a47928e551c719c2281758e73558f24234d36b807  myvim

//press tab when input "docker r", then all command that begins with "r" will be displayed.
root@SZX1000041895:~/sleep# docker help r
rename   restart  rm       rmi      run
dnephin commented 8 years ago

I think https://github.com/docker/compose/tree/master/contrib/completion should work, no?

vdemeester commented 8 years ago

@bohai I think it should yeah (except for the docker-compose command part :stuck_out_tongue: https://github.com/docker/compose/blob/master/contrib/completion/bash/docker-compose#L443).