Fix indentation & remove tabs

This commit is contained in:
Pierre-Louis Bonicoli 2024-06-17 01:55:41 +02:00
parent f8c31523c9
commit 4c8d0de5ba
Signed by: pilou
GPG Key ID: 06914C4A5EDAA6DD

View File

@ -107,14 +107,14 @@ generateSpecificReport()
#$(curl -s "https://forge.chapril.org/api/v1/admin/orgs?limit=100000&token=$GITEA_API_KEY" | jq '. | length' > t) #$(curl -s "https://forge.chapril.org/api/v1/admin/orgs?limit=100000&token=$GITEA_API_KEY" | jq '. | length' > t)
local organizationCount=$(curl -s "https://forge.chapril.org/api/v1/admin/orgs?limit=100000&token=$GITEA_API_KEY" | jq '. | length') local organizationCount=$(curl -s "https://forge.chapril.org/api/v1/admin/orgs?limit=100000&token=$GITEA_API_KEY" | jq '. | length')
if [[ -z "$organizationCount" ]]; then if [[ -z "$organizationCount" ]]; then
organizationCount=0 organizationCount=0
fi fi
echo "Nombre d'organisations = $organizationCount" echo "Nombre d'organisations = $organizationCount"
#$(curl -s "https://forge.chapril.org/api/v1/orgs?limit=100000" > t) #$(curl -s "https://forge.chapril.org/api/v1/orgs?limit=100000" > t)
local publicOrganizationCount=$(curl -s "https://forge.chapril.org/api/v1/orgs?limit=100000" | jq '. | length') local publicOrganizationCount=$(curl -s "https://forge.chapril.org/api/v1/orgs?limit=100000" | jq '. | length')
if [[ -z "$publicOrganizationCount" ]]; then if [[ -z "$publicOrganizationCount" ]]; then
publicOrganizationCount=0 publicOrganizationCount=0
fi fi
echo "Nombre d'organisations publiques = $publicOrganizationCount" echo "Nombre d'organisations publiques = $publicOrganizationCount"
@ -157,45 +157,45 @@ if [ "$#" = 1 ] && [ "$1" = "-h" ]; then
help help
elif [ "$#" = 1 ] && [ "$1" = "-p" ]; then elif [ "$#" = 1 ] && [ "$1" = "-p" ]; then
if [ "$(date +%m)" -gt 1 ]; then if [ "$(date +%m)" -gt 1 ]; then
precedingMonth="$((10#$(date +%m)-1))" precedingMonth="$((10#$(date +%m)-1))"
year="$(date +%Y)" year="$(date +%Y)"
if [ $precedingMonth -lt 10 ]; then if [ $precedingMonth -lt 10 ]; then
yearMonth="$year-0$precedingMonth" yearMonth="$year-0$precedingMonth"
else else
yearMonth="$year-$precedingMonth" yearMonth="$year-$precedingMonth"
fi fi
else [ "$(date +%m)" -eq 1 ] else [ "$(date +%m)" -eq 1 ]
precedingMonth=12 precedingMonth=12
year="$(($(date +%Y)-1))" year="$(($(date +%Y)-1))"
yearMonth="$year-$precedingMonth" yearMonth="$year-$precedingMonth"
fi fi
monthEnglish=$(LANG=en_EN.UTF-8;date -d $year-$precedingMonth-01 +%b) monthEnglish=$(LANG=en_EN.UTF-8;date -d $year-$precedingMonth-01 +%b)
generateReport "$monthEnglish" "$year" "$yearMonth" generateReport "$monthEnglish" "$year" "$yearMonth"
elif [ "$#" -eq 2 ]; then elif [ "$#" -eq 2 ]; then
if ! (let "$1") 2>/dev/null; then if ! (let "$1") 2>/dev/null; then
echo -e "Le mois doit être numérique." echo -e "Le mois doit être numérique."
help help
elif ([ "$1" -lt 1 ] || [ "$1" -gt 12 ]); then elif ([ "$1" -lt 1 ] || [ "$1" -gt 12 ]); then
echo -e "Numéro du mois non valable $1." echo -e "Numéro du mois non valable $1."
help help
elif ! (let "$2") 2>/dev/null; then elif ! (let "$2") 2>/dev/null; then
echo -e "L'année doit être numérique." echo -e "L'année doit être numérique."
help help
elif [ "$2" -lt 2018 ] || [ "$2" -gt "$(date +%Y)" ]; then elif [ "$2" -lt 2018 ] || [ "$2" -gt "$(date +%Y)" ]; then
echo -e "Année non valable $2." echo -e "Année non valable $2."
help help
elif [ "$2" -le 2017 ] || [ "$2" -ge $(($(date +%Y)+1)) ] ; then elif [ "$2" -le 2017 ] || [ "$2" -ge $(($(date +%Y)+1)) ] ; then
echo -e "Pas de données pour ce mois." echo -e "Pas de données pour ce mois."
help help
else else
if [ "$1" -lt 10 ]; then if [ "$1" -lt 10 ]; then
yearMonth="$2-0$1" yearMonth="$2-0$1"
else else
yearMonth="$2-$1" yearMonth="$2-$1"
fi fi
monthEnglish=$(LANG=en_EN.UTF-8;date -d "$2-$1-01" +%b) monthEnglish=$(LANG=en_EN.UTF-8;date -d "$2-$1-01" +%b)
year="$2" year="$2"
generateReport "$monthEnglish" "$year" "$yearMonth" generateReport "$monthEnglish" "$year" "$yearMonth"
fi fi
elif [ "$#" -eq 0 ]; then elif [ "$#" -eq 0 ]; then
yearMonth="$(date +%Y-%m)" yearMonth="$(date +%Y-%m)"