xephwrap: Polish

This commit is contained in:
Salt 2019-01-03 21:43:30 -06:00
parent 210f7f4c83
commit 06352b30a6
1 changed files with 9 additions and 7 deletions

View File

@ -6,25 +6,27 @@
# Distributed under terms of the MIT license.
#
name="$(basename $0 .sh)"
name="$(basename -- "$0" .sh)"
function log() {
log() {
[ -z ${1+x} ] && return 1
printf "\e[94m$name\e[0m: $1\n"
printf "\\e[94m%s\\e[0m: %s\\n" \
"$name" \
"$1"
}
function xprompt() {
xprompt() {
[ -z ${1+x} ] && return 2
[ -z ${2+x} ] || default="$2"; suffix=" [$default]"
read -p "$1$suffix: "
read -rp "$1$suffix: "
if [ "$REPLY" == "" ]; then
export REPLY="$2"
fi
}
function validatedep() {
validatedep() {
[ -z ${1+x} ] && return 2
if ! which "$1" > /dev/null 2>&1; then
if ! command -v "$1" > /dev/null 2>&1; then
return 1
fi
return 0