#!/bin/bash source "$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." &> /dev/null && pwd)/etc/config" source "$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." &> /dev/null && pwd)/etc/projects" function usage { echo echoMainTitle "List all projects" echo echoSubTitle "Usage:" echo echo "list-projects" echo echo "--help Prints this message" echo } function listProjects { echo >&2 echoSubTitle "Projects list" >&2 echo >&2 for i in "${!projects[@]}" do echo "- Shortname: ${shortnames[$i]} Customer: ${customers[$i]} Project: ${projects[$i]}" >&2 echo done } echo echoMainTitle "Listing projects" help="$(getParameter "--help" false "$*")" if [ "$help" == true ] then usage exit else if [ "${#projects[@]}" -eq 0 ] then echo echo "There are currently no projects setted up" echo else listProjects fi fi echoSuccess "Listing done"