dk: aliases de filtres

This commit is contained in:
Jephté Clain 2020-03-27 18:58:23 +04:00
parent 1b12cee1fb
commit ccf3c67278
1 changed files with 11 additions and 2 deletions

13
dk
View File

@ -106,6 +106,9 @@ COMMANDES
- name=<string> a task's name or prefix
- node=<string> a node's name or ID
- desired-state=(running|shutdown|accepted)
Pour faciliter l'utilisation des filtres, certains aliases sont définis.
'=r', '=k' et '=a' sont des aliases pour desired-state=running,
desired-state=shutdown et desired-state=accepted respectivement
u|update SERVICE [args...]
Mettre à jour un service, équivalent à 'service update SERVICE'
scale SERVICE=REPLICAS [args...]
@ -1301,12 +1304,18 @@ function auto_status() {
fi
local -a psargs
local fnum
local filter fnum
psargs=(
--format "taskID={{.ID}};node={{.Node}};desiredState='{{.DesiredState}}';currentState='{{.CurrentState}}';__status_process_data"
)
while [[ "$1" == *=* ]]; do
psargs+=(--filter "$1")
filter="$1"
case "$filter" in
=r) filter="desired-state=running";;
=k) filter="desired-state=shutdown";;
=a) filter="desired-state=accepted";;
esac
psargs+=(--filter "$filter")
shift
done
fnum="$1"; shift