-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.bash
More file actions
36 lines (28 loc) · 1.15 KB
/
Copy pathdocker-compose.bash
File metadata and controls
36 lines (28 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
dc () { docker-compose $@; }
dtop() { docker-compose stats; }
# Runs all or mentions service(s) in the current docker-compose.yml in the background
dup() { docker-compose up -d $@; }
# Kills all or mentions service(s) in the current docker-compose.yml
ddown() { echo $@ ; docker-compose down $@; }
# Shows logs of all or mentions service(s) in the current docker-compose.yml
dlog() { docker-compose logs -f $1; }
# Shows status of all or mentions service(s) in the current docker-compose.yml
dps() { docker-compose ps; }
# Get a shell to mentioned service
dbash(){
docker-compose exec $1 bash;
if [ $? -gt 0 ]; then
echo "No bash shell found in the container, trying sh";
docker-compose exec $1 sh;
fi
}
_completion_service_list() {
local current_word="${COMP_WORDS[COMP_CWORD]}"
local suggestions=($(docker-compose ps --services))
COMPREPLY=($(compgen -W "${suggestions[*]}" -- "$current_word"))
}
# Register the completion function to be called for dlog
complete -F _completion_service_list dup;
complete -F _completion_service_list ddown;
complete -F _completion_service_list dlog;
complete -F _completion_service_list dbash;