afficher le profil courant

This commit is contained in:
Jephté Clain 2018-10-01 09:28:20 +04:00
parent 3a4cc1258d
commit 2873638aa5
2 changed files with 16 additions and 3 deletions

15
dk
View File

@ -234,8 +234,11 @@ function auto_down() {
fi fi
} }
DEFAULT_PROFILE=devel
set_defaults dk
chdir= chdir=
profile=devel profile=
args=(+ args=(+
--help '$exit_with display_help' --help '$exit_with display_help'
-d:,--chdir: chdir= -d:,--chdir: chdir=
@ -245,10 +248,11 @@ args=(+
) )
parse_args "$@"; set -- "${args[@]}" parse_args "$@"; set -- "${args[@]}"
[ -n "$chdir" ] && { cd "$chdir" || die; }
# construire par défaut # construire par défaut
[ $# -eq 0 ] && set -- build [ $# -eq 0 ] && set -- build
[ -n "$profile" ] || profile="$DEFAULT_PROFILE"
[ -n "$chdir" ] && { cd "$chdir" || die; }
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
[ "$1" == -- ] && { shift; continue; } [ "$1" == -- ] && { shift; continue; }
@ -261,6 +265,7 @@ while [ $# -gt 0 ]; do
while [ $# -gt 0 -a "$1" != -- ]; do while [ $# -gt 0 -a "$1" != -- ]; do
args+=("$1"); shift args+=("$1"); shift
done done
enote "Profil $profile"
auto_build "${args[@]}" || die auto_build "${args[@]}" || die
;; ;;
s|run|start) s|run|start)
@ -268,9 +273,11 @@ while [ $# -gt 0 ]; do
while [ $# -gt 0 -a "$1" != -- ]; do while [ $# -gt 0 -a "$1" != -- ]; do
args+=("$1"); shift args+=("$1"); shift
done done
enote "Profil $profile"
auto_up "${args[@]}" || die auto_up "${args[@]}" || die
;; ;;
k|stop) k|stop)
enote "Profil $profile"
auto_stop || die auto_stop || die
;; ;;
1|up) 1|up)
@ -278,6 +285,7 @@ while [ $# -gt 0 ]; do
while [ $# -gt 0 -a "$1" != -- ]; do while [ $# -gt 0 -a "$1" != -- ]; do
args+=("$1"); shift args+=("$1"); shift
done done
enote "Profil $profile"
auto_up "${args[@]}" && auto_logs || die auto_up "${args[@]}" && auto_logs || die
;; ;;
l|logs) auto_logs || die;; l|logs) auto_logs || die;;
@ -293,6 +301,7 @@ while [ $# -gt 0 ]; do
while [ $# -gt 0 -a "$1" != -- ]; do while [ $# -gt 0 -a "$1" != -- ]; do
args+=("$1"); shift args+=("$1"); shift
done done
enote "Profil $profile"
if auto_build; then if auto_build; then
auto_up "${args[@]}" && auto_logs || die auto_up "${args[@]}" && auto_logs || die
else else

4
lib/default/dk Normal file
View File

@ -0,0 +1,4 @@
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
# Profil par défaut
#PROFILE=prod