Error management

This commit is contained in:
Thomas Forgione 2019-04-17 16:46:15 +02:00
parent 7fc0bddb76
commit 911ed44e39
No known key found for this signature in database
GPG Key ID: 203DAEA747F48F41
1 changed files with 35 additions and 15 deletions

View File

@ -255,6 +255,32 @@ _print_help() {
echo
}
partial-test() {
case $1 in;
"system") return 0;;
"rust") return 0;;
"npm") return 0;;
"dotfiles") return 0;;
"neovim") return 0;;
"check") return 0;;
"startup") return 0;;
*) return 1;;
esac
}
partial-update() {
case $1 in;
"system") update-system;;
"rust") update-rust;;
"npm") update-npm;;
"dotfiles") update-dotfiles;;
"neovim") update-neovim;;
"check") _check_date_if_format force;;
"startup") _check_date_if_format;;
*) return 1
esac
}
main() {
if [ $# -eq 0 ]; then
@ -292,22 +318,16 @@ main() {
else
while [ $# -gt 0 ]; do
case $1 in;
"system") update-system;;
"rust") update-rust;;
"npm") update-npm;;
"dotfiles") update-dotfiles;;
"neovim") update-neovim;;
"check") _check_date_if_format force;;
"startup") _check_date_if_format;;
esac
shift
for part in $@; do
partial-test $part
if [ $? -ne 0 ]; then
echo "\033[1;31merror:\033[0m unrocognized update command \"$part\""
return 1
fi
done
for part in $@; do
partial-update $part
done
fi