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

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

refact(setup) move HELP msg to the top

parent b405c5e5
No related branches found
No related tags found
No related merge requests found
#!/bin/bash #!/bin/bash
## Functions to setup BDAP user account for bash & git (only if pending).
# #
# Call this script with the name of the action-function as arg[1]. # Call this script with the name of the action-function as arg[1].
function _HELP { echo \
"$mycmd - setup a BDAP user account with (pending) actions for keyboard, bash, git, conda
SYNTAX:
$mycmd [ACTION]...
WHERE ACTION is:
$(for i in $(_list_all_actions); do echo " $i"; done)
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.
"
}
set -e set -e
mycmd="${0##*/}"
mydir=$(realpath "${0%/*}")
cd "$mydir"
function _short { function _short {
## Return vars relative to PWD, prefixed with "./" ## Return vars relative to PWD, prefixed with "./"
# as conda env needs # as conda env needs
...@@ -17,9 +34,6 @@ function _short { ...@@ -17,9 +34,6 @@ function _short {
fi fi
} }
mydir=$(realpath "${0%/*}")
cd "$mydir"
mycmd="${0##*/}"
conda_env_prefix=$(_short "$mydir/env") conda_env_prefix=$(_short "$mydir/env")
function _mute { function _mute {
...@@ -318,7 +332,9 @@ function all { ...@@ -318,7 +332,9 @@ function all {
## Trick to search if NOT help- asked ## Trick to search if NOT help- asked
# from: https://superuser.com/a/1002826/227922 # from: https://superuser.com/a/1002826/227922
if [[ "${@#-h}" = "$@" && "${@#--help}" = "$@" ]]; then if [[ "${@#-h}" != "$@" || "${@#--help}" != "$@" ]]; then
_HELP
else
if [[ $# -eq 0 ]]; then if [[ $# -eq 0 ]]; then
echo "Running all actions..." echo "Running all actions..."
all all
...@@ -329,18 +345,4 @@ if [[ "${@#-h}" = "$@" && "${@#--help}" = "$@" ]]; then ...@@ -329,18 +345,4 @@ if [[ "${@#-h}" = "$@" && "${@#--help}" = "$@" ]]; then
$cmd $cmd
done done
fi fi
else
echo "$mycmd - actions to setup a BDAP user account.
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