diff options
Diffstat (limited to 'src/hooks/fancy')
-rwxr-xr-x | src/hooks/fancy | 90 |
1 files changed, 0 insertions, 90 deletions
diff --git a/src/hooks/fancy b/src/hooks/fancy deleted file mode 100755 index a64514e..0000000 --- a/src/hooks/fancy +++ /dev/null @@ -1,90 +0,0 @@ -# Fancy output is for terminal output only. -[[ -t 1 ]] || return - - -### Fancy Logging/Error reporting - -function report_err { - print_prefixed "${FANCY_OTHER}" "${FANCY_HIGHLIGHT}$*" -} - -function report_notice { - print_prefixed "${FANCY_OTHER}" "$*" -} - -function report_try { - printf "${FANCY_OTHER}${PREFIX_BUSY}${FANCY_NORMAL} %s " "$*" - report_busy - REPORT_TRYING=1 -} - -function report_fail { - if [[ -n "$*" ]]; then - if [[ -n "$REPORT_TRYING" ]]; then - report_append "$*" - report_failed - REPORT_TRYING= - else - print_prefixed "${FANCY_FAILED}" "${FANCY_HIGHLIGHT}$*" - fi - elif [[ -n "$REPORT_TRYING" ]]; then - report_failed - REPORT_TRYING= - fi -} - -function report_success { - if [[ -n "$*" ]]; then - if [[ -n "$REPORT_TRYING" ]]; then - report_append "$*" - report_done - REPORT_TRYING= - else - print_prefixed "${FANCY_DONE}" "$*" - fi - elif [[ -n "$REPORT_TRYING" ]]; then - report_done - REPORT_TRYING= - fi -} - -function report_append { - printf -- "${RESTORE_POSITION}${FANCY_OTHER}-${FANCY_NORMAL} %s " "$*" -} - -function report_busy { - printf "${CURSOR_STATUS} [${FANCY_BUSY} BUSY ${FANCY_NORMAL}] " -} - -function report_failed { - printf "${CURSOR_STATUS} [${FANCY_FAILED}FAILED${FANCY_NORMAL}]\n" -} - -function report_done { - printf "${CURSOR_STATUS} [${FANCY_DONE} DONE ${FANCY_NORMAL}]\n" -} - -function print_prefixed { - local c_prefix=$1 - shift - printf "${c_prefix}${PREFIX_ATTENTION}${FANCY_NORMAL} %s${FANCY_NORMAL}\n" "$*" -} - - -SAVE_POSITION=$(tput sc) -RESTORE_POSITION=$(tput rc) -COLUMNS=$(tput cols) -(( COLUMNS == 0 )) && COLUMNS=80 -CURSOR_STATUS=${SAVE_POSITION}$(tput hpa $(( COLUMNS - 10 )) ) - -FANCY_NORMAL=$(tput sgr0) -FANCY_HIGHLIGHT=${FANCY_NORMAL}$(tput bold) -FANCY_BUSY=${FANCY_NORMAL}$(tput setaf 6) # cyan -FANCY_FAILED=${FANCY_HIGHLIGHT}$(tput setaf 1) # red -FANCY_DONE=${FANCY_HIGHLIGHT}$(tput setaf 2) # green -FANCY_OTHER=${FANCY_HIGHLIGHT}$(tput setaf 4) # blue - -PREFIX_BUSY="::" -PREFIX_ATTENTION=" >" - -# vim: ft=sh ts=4 et sw=4: |