xephwrap: Polish
This commit is contained in:
parent
210f7f4c83
commit
06352b30a6
16
xephwrap
16
xephwrap
@ -6,25 +6,27 @@
|
|||||||
# Distributed under terms of the MIT license.
|
# Distributed under terms of the MIT license.
|
||||||
#
|
#
|
||||||
|
|
||||||
name="$(basename $0 .sh)"
|
name="$(basename -- "$0" .sh)"
|
||||||
|
|
||||||
function log() {
|
log() {
|
||||||
[ -z ${1+x} ] && return 1
|
[ -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 ${1+x} ] && return 2
|
||||||
[ -z ${2+x} ] || default="$2"; suffix=" [$default]"
|
[ -z ${2+x} ] || default="$2"; suffix=" [$default]"
|
||||||
read -p "$1$suffix: "
|
read -rp "$1$suffix: "
|
||||||
if [ "$REPLY" == "" ]; then
|
if [ "$REPLY" == "" ]; then
|
||||||
export REPLY="$2"
|
export REPLY="$2"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function validatedep() {
|
validatedep() {
|
||||||
[ -z ${1+x} ] && return 2
|
[ -z ${1+x} ] && return 2
|
||||||
if ! which "$1" > /dev/null 2>&1; then
|
if ! command -v "$1" > /dev/null 2>&1; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
|
Loading…
Reference in New Issue
Block a user