Add a check_command

This commit is contained in:
Benoit S 2021-08-29 09:51:27 +09:00
parent e162208168
commit a973393b28

View file

@ -118,6 +118,14 @@ statuses_remove(){
$DRY_RUN || $TOOTCTL statuses remove --days "$STATUSES_REMOVE_DAYS" $DRY_RUN || $TOOTCTL statuses remove --days "$STATUSES_REMOVE_DAYS"
} }
check_command(){
command -v "$1" > /dev/null
}
for command in $TOOTCTL curl grep awk cut sort; do
check_command "$command" || (echo "$command not found, exiting..."; exit 1)
done
$DO_ACCOUNTS_CULL && accounts_cull $DO_ACCOUNTS_CULL && accounts_cull
$DO_MEDIA_REMOVE && media_remove $DO_MEDIA_REMOVE && media_remove
$DO_STATUSES_REMOVE && statuses_remove $DO_STATUSES_REMOVE && statuses_remove