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>
Upstream-commit: 24d7795c2c
Component: cli
This commit is contained in:
committed by
Tibor Vass
parent
6674e3a1f5
commit
cc04f0bef8
@ -463,6 +463,16 @@ __docker_complete_services() {
|
||||
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
|
||||
# word in `$COMPREPLY`.
|
||||
# Normally you do this with `compgen -S` while generating the completions.
|
||||
@ -2830,13 +2840,13 @@ _docker_service() {
|
||||
local subcommands="
|
||||
create
|
||||
inspect
|
||||
logs
|
||||
ls
|
||||
rm
|
||||
scale
|
||||
ps
|
||||
update
|
||||
"
|
||||
__docker_daemon_is_experimental && subcommands+="logs"
|
||||
|
||||
local aliases="
|
||||
list
|
||||
@ -2888,7 +2898,7 @@ _docker_service_logs() {
|
||||
*)
|
||||
local counter=$(__docker_pos_first_nonflag '--since|--tail')
|
||||
if [ $cword -eq $counter ]; then
|
||||
__docker_complete_services
|
||||
__docker_complete_services_and_tasks
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
Reference in New Issue
Block a user