#!/bin/bash
# Simple helper functions

yesno_default_no() {
    read -p "$1 (y/N)? " -r -n 1 answer;
    [[ $answer == [Yy] ]] && retval=1 || retval=0
    echo
    return $retval  # retval=1 means yes.
}

yesno_default_yes() {
    read -p "$1 (Y/n)? " -r -n 1 answer;
    [[ $answer == [Nn] ]] && retval=0 || retval=1
    echo
    return $retval  # retval=1 means yes.
}

warning() {
    tput bold
    echo -e "\n WARNING: $1\n"
    tput sgr0
}

error() {
    tput bold
    echo -e "\n ERROR: $1\n"
    tput sgr0
}

success() {
    tput bold
    echo -e "\n SUCCESS: $1\n"
    tput sgr0
}

message() {
    tput bold
    echo -e "\n MESSAGE: $1\n"
    tput sgr0
}
