Skip to content

Commit

Permalink
feat: task switch case
Browse files Browse the repository at this point in the history
  • Loading branch information
janikvonrotz committed Jan 21, 2025
1 parent ecbfdcb commit ec90ac9
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 67 deletions.
4 changes: 2 additions & 2 deletions roles/metabase/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ metabase_timezone: Europe/Zurich
metabase_db_type: postgres
metabase_db_port: "5432"
metabase_db_dbname: metabase
metabase_postgresdb_user: metabase
metabase_postgresdb_pass: "{{ vault_metabase_postgresdb_pass }}"
metabase_db_user: metabase
metabase_db_pass: "{{ vault_metabase_db_pass }}"
100 changes: 35 additions & 65 deletions task
Original file line number Diff line number Diff line change
Expand Up @@ -163,68 +163,38 @@ function test() {
fi
}

case "$1" in
generate-vault-password)
generate-vault-password "$2" "$3"
;;
encrypt-string)
encrypt-string "$2" "$3"
;;
convert-vault-file)
convert-vault-file "$2" "$3"
;;
install)
install
;;
install-exo)
install-exo
;;
upgrade)
upgrade
;;
version)
version
;;
update-docs)
update-docs
;;
list-hosts)
list-hosts "$2"
;;
galaxy-build)
galaxy-build
;;
galaxy-publish)
galaxy-publish
;;
node-install)
npm install
;;
node-dev)
npm run dev
;;
node-build)
npm run build
;;
node-serve-build)
cd .vuepress/dist
npx serve
;;
lint)
activate-venv
ansible-lint --write --offline roles/*
;;
source)
activate-venv
;;
test)
test "$2"
;;
show-passwordless-sudo)
show-passwordless-sudo "$2"
;;
*)
help task
exit 1
;;
esac
if declare -f "$1" > /dev/null; then
"$1" "${@:2}"
else
case "$1" in
help)
help task
exit 1
;;
node-install)
npm install
;;
node-dev)
npm run dev
;;
node-build)
npm run build
;;
node-serve-build)
cd .vuepress/dist
npx serve
;;
lint)
activate-venv
ansible-lint --write --offline roles/*
;;
source)
activate-venv
;;
*)
echo "Unknown command: $1"
help task
exit 1
;;
esac
fi

0 comments on commit ec90ac9

Please sign in to comment.