1
0
Fork 0
forked from ahurac/dotfiles
ahuarc-dotfiles/bin/updateall

51 lines
938 B
Text
Raw Normal View History

2023-04-13 00:04:20 +02:00
#!/bin/bash
# Variables
realpath="$(readlink -f "$0")"
2023-04-13 00:04:20 +02:00
# cd
cd "${HOME}/.config/$(basename "$realpath")" || exit
unset realpath
2023-04-13 00:57:54 +02:00
scripts_d=./scripts
# 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
printf %s "$line"
}
2023-04-13 00:04:20 +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
}
# Procédure principale
main() {
for i in "${scripts_d}/"*; do
separator "$(basename "$i" | cut -d '-' -f 2)"
"$i"
done
}
script="$1"
shift
case "$script" in
"")
main "$@"
;;
*)
# Oui, ShellCheck, c'est bel et bien ce que j'essaie de faire
# shellcheck disable=SC2211
"${scripts_d}/"??"-${script}" "$@"
;;
esac
2023-04-13 00:04:20 +02:00