Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit 6f60b639 authored by Kostis ANAGNOSTOPOULOS's avatar Kostis ANAGNOSTOPOULOS Committed by inp
Browse files

feat(setup) exec many actions in cmdline; >

* feat: provide help-msg if --help/-h given anywhere in args.
* refact: simplify help-msg formatting in one cmd.
parent fd8279ce
No related branches found
No related tags found
No related merge requests found
...@@ -279,20 +279,31 @@ function all { ...@@ -279,20 +279,31 @@ function all {
done done
} }
if [[ $# -eq 1 && ( "$1" = "-h" || "$1" = "--help" ) ]]; then ## Trick to search if NOT help- asked
echo -e "$mycmd - actions to setup a BDAP user account.\n" # from: https://superuser.com/a/1002826/227922
echo -e "SYNTAX:\n $mycmd\n $mycmd ACTION\nWHERE:\n ACTION is one of:" if [[ "${@#-h}" = "$@" && "${@#--help}" = "$@" ]]; then
_list_all_actions if [[ $# -eq 0 ]]; then
echo -e '\nWithout any args, it launches `all` actions, in order.' echo "Running all actions..."
echo -e '\nNOTES:\n * The `upd30_git_user` action awaits interactively input from the user.' all
echo -e ' * You may have to logout & re-login after `upd40_bashrc_conda_init`, else
for `upd50_create_conda_env` to succeed.' echo "Running x$# actions: '${@}'"
echo -e ' * You can repeatedly run this script, until all action succeed.' ## execute the asked action.
elif [[ $# -eq 0 ]]; then for cmd in "${@}"; do
echo "Running all actions..." $cmd
all done
fi
else else
## execute the asked action. echo "$mycmd - actions to setup a BDAP user account.
echo "Running '${@}' action..." SYNTAX:
"${@}" $mycmd [ACTION]...
WHERE:
ACTION is one of:
$(_list_all_actions)
NOTES:
* Without any args, it launches 'all' actions above, in that order.
* The 'upd30_git_user_XXX' actions awaits interactively input from the user.
* You may have to logout & re-login after 'upd40_bashrc_conda_init',
for 'upd50_create_conda_env' to succeed.
* You can repeatedly run this script, until all actions succeed.
"
fi fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment