Added asserts

master
Stephen Cochrane 3 years ago
parent b20f8c4871
commit 541474fb4e
  1. 9
      import/alert.sh
  2. 6
      slock

@ -4,6 +4,7 @@
# USAGE: error "message" <exit_code>
RED='\033[0;31m'
YELLOW='\033[1;33m'
GREEN='\e[92m'
NC='\033[0m'
# Display an error message and exit.
@ -16,3 +17,11 @@ error () {
warning () {
printf "[${YELLOW}WARNING${NC}] $1\n"
}
success () {
printf "[${GREEN}SUCCESS${NC}] $1\n"
}
tick () {
printf "$1 ${GREEN}${NC}\n"
}

@ -8,9 +8,9 @@ SCRIPT_PATH=$(dirname $0)
# Check dependencies
[ ! $(command -v error) ] && echo "[WARNING] Missing 'alert.sh' import"
[ ! $(command -v i3lock) ] && error "Missing command 'i3lock'"
[ ! $(command -v scrot) ] && error "Missing command 'scrot'"
[ ! $(command -v convert) ] && error "Missing 'convert', provided by ImageMagick"
[ ! $(command -v i3lock) ] && error "Missing command 'i3lock'" || tick "'i3lock' found"
[ ! $(command -v scrot) ] && error "Missing command 'scrot'" || tick "'scrot' found"
[ ! $(command -v convert) ] && error "Missing 'convert', provided by ImageMagick" || tick "'convert' found"
path="$HOME/Pictures"
scrot $path/.slock.png

Loading…
Cancel
Save