2023-04-13 00:04:20 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2023-06-04 19:38:42 +02:00
|
|
|
# Variables
|
|
|
|
realpath="$(readlink -f "$0")"
|
2023-04-13 00:04:20 +02:00
|
|
|
|
2023-06-04 19:38:42 +02:00
|
|
|
# cd
|
|
|
|
cd "$(dirname "$realpath")/../share/$(basename "$realpath")" || exit
|
|
|
|
unset realpath
|
2023-04-13 00:57:54 +02:00
|
|
|
|
2023-06-16 11:44:11 +02:00
|
|
|
scripts_d=./scripts.d
|
|
|
|
|
2023-06-04 19:38:42 +02:00
|
|
|
# Fonction pour fabriquer une ligne de la longueur d'un tiers du terminal
|
|
|
|
makeline() {
|
|
|
|
local cols line
|
|
|
|
cols="$(($(tput cols) / 3))"
|
|
|
|
while [ "${#line}" -lt "$cols" ]; do
|
|
|
|
line="${line}${1}"
|
2023-04-13 00:04:20 +02:00
|
|
|
done
|
2023-06-04 19:38:42 +02:00
|
|
|
printf %s "$line"
|
|
|
|
}
|
2023-04-13 00:04:20 +02:00
|
|
|
|
2023-06-04 19:38:42 +02:00
|
|
|
# Fonction pour afficher un séparateur
|
|
|
|
separator() {
|
|
|
|
local line
|
|
|
|
line="$(makeline '=')"
|
|
|
|
printf '\n%s\n\t%s\n%s\n' "$line" "$*" "$line"
|
2023-04-13 00:04:20 +02:00
|
|
|
}
|
|
|
|
|
2023-06-04 19:38:42 +02:00
|
|
|
# Procédure principale
|
2023-06-16 11:44:11 +02:00
|
|
|
main() {
|
|
|
|
for i in "${scripts_d}/"*; do
|
2023-09-15 10:04:54 +02:00
|
|
|
separator "$(basename "$i" | cut -d '-' -f 2)"
|
2023-06-16 11:44:11 +02:00
|
|
|
"$i"
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
script="$1"
|
|
|
|
shift
|
|
|
|
|
|
|
|
case "$script" in
|
|
|
|
"")
|
|
|
|
main "$@"
|
|
|
|
;;
|
|
|
|
*)
|
2023-09-15 10:04:54 +02:00
|
|
|
"${scripts_d}/"??"-${script}" "$@"
|
2023-06-16 11:44:11 +02:00
|
|
|
;;
|
|
|
|
esac
|
2023-04-13 00:04:20 +02:00
|
|
|
|