mirror of https://github.com/docker/cli.git
Bash completion treats `service logs` as stable
Implements the following new CLI features: - service logs is no longer experimental - service logs also accepts task IDs Signed-off-by: Harald Albers <github@albersweb.de>
This commit is contained in:
parent
0e75012be1
commit
24d7795c2c
|
@ -463,6 +463,16 @@ __docker_complete_services() {
|
||||||
COMPREPLY=( $(compgen -W "$(__docker_services "$@")" -- "$current") )
|
COMPREPLY=( $(compgen -W "$(__docker_services "$@")" -- "$current") )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# __docker_tasks returns a list of all task IDs.
|
||||||
|
__docker_tasks() {
|
||||||
|
__docker_q service ps --format '{{.ID}}' ""
|
||||||
|
}
|
||||||
|
|
||||||
|
# __docker_complete_services_and_tasks applies completion of services and task IDs.
|
||||||
|
__docker_complete_services_and_tasks() {
|
||||||
|
COMPREPLY=( $(compgen -W "$(__docker_services "$@") $(__docker_tasks)" -- "$cur") )
|
||||||
|
}
|
||||||
|
|
||||||
# __docker_append_to_completions appends the word passed as an argument to every
|
# __docker_append_to_completions appends the word passed as an argument to every
|
||||||
# word in `$COMPREPLY`.
|
# word in `$COMPREPLY`.
|
||||||
# Normally you do this with `compgen -S` while generating the completions.
|
# Normally you do this with `compgen -S` while generating the completions.
|
||||||
|
@ -2830,13 +2840,13 @@ _docker_service() {
|
||||||
local subcommands="
|
local subcommands="
|
||||||
create
|
create
|
||||||
inspect
|
inspect
|
||||||
|
logs
|
||||||
ls
|
ls
|
||||||
rm
|
rm
|
||||||
scale
|
scale
|
||||||
ps
|
ps
|
||||||
update
|
update
|
||||||
"
|
"
|
||||||
__docker_daemon_is_experimental && subcommands+="logs"
|
|
||||||
|
|
||||||
local aliases="
|
local aliases="
|
||||||
list
|
list
|
||||||
|
@ -2888,7 +2898,7 @@ _docker_service_logs() {
|
||||||
*)
|
*)
|
||||||
local counter=$(__docker_pos_first_nonflag '--since|--tail')
|
local counter=$(__docker_pos_first_nonflag '--since|--tail')
|
||||||
if [ $cword -eq $counter ]; then
|
if [ $cword -eq $counter ]; then
|
||||||
__docker_complete_services
|
__docker_complete_services_and_tasks
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
Loading…
Reference in New Issue