#!/usr/bin/env zsh set -e # URL of icon generator api="http://icons.deanishe.net/icon" here="$( cd "$( dirname "$0" )"; pwd )" root="$( cd "$here/../"; pwd )" # where workflow icons belong icondir="${root}/src/icons" # icon config file iconfile="${root}/icons.txt" prog="$( basename "$0" )" force=false verbose=false vopt= icons=() # log ... | Echo arguments to STDERR log() { echo "$@" >&2 } # info .. | Write args to STDERR if VERBOSE is true info() { $verbose && log $(print -P "%F{blue}..%f") "$@" return 0 } # success .. | Write green "ok" and args to STDERR if VERBOSE is true success() { $verbose && log $(print -P "%F{green}ok%f") "$@" return 0 } # error .. | Write red "error" and args to STDERR error() { log $(print -P '%F{red}error%f') "$@" } # fail .. | Write red "error" and args to STDERR, then exit with status 1 fail() { error "$@" exit 1 } # load | Read configuration file from STDIN load() { typeset -g icons while read line; do # ignore lines that start with # or are empty [[ $line =~ "#" ]] || test -z "$line" && continue read fname font colour name <<< "$line" icons+=($fname $font $colour $name) done } usage() { cat <