From bed3965013b66e00af8aa05a198066e1de9af777 Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Mon, 28 Dec 2020 16:53:25 +0100 Subject: [PATCH] [enh] default value for packages list if empty --- ynh-dev | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/ynh-dev b/ynh-dev index 20ad02b..cddd5ad 100755 --- a/ynh-dev +++ b/ynh-dev @@ -212,10 +212,16 @@ function show_vm_ip() function use_git() { assert_inside_vm - local PACKAGES="$@" - for PACKAGE in "$PACKAGES"; + local PACKAGES=("$@") + + if [ "$PACKAGES" = "" ] + then + PACKAGES=('moulinette' 'ssowat' 'yunohost' 'yunohost-admin') + fi + + for i in ${!PACKAGES[@]}; do - case $PACKAGE in + case ${PACKAGES[i]} in ssowat) create_sym_link "/ynh-dev/ssowat" "/usr/share/ssowat" success "Now using Git repository for SSOwat" @@ -312,7 +318,7 @@ function use_git() ;; *) - error "Invalid package '$PACKAGE': correct arguments are 'yunohost', 'ssowat', 'moulinette', 'yunohost-admin'" + error "Invalid package '${PACKAGES[i]}': correct arguments are 'yunohost', 'ssowat', 'moulinette', 'yunohost-admin' or nothing for all" ;; esac done @@ -373,4 +379,4 @@ function run_tests() done } -main "$@" +main $@