Polish comments

This commit is contained in:
Salt 2019-06-22 00:33:44 -05:00
parent b0b4b673eb
commit 73f9ec4294

View File

@ -19,12 +19,14 @@ exec 1023<> <(:)
# Basic functions # Basic functions
print() { print() {
# Write a message to STDOUT without a name attached # Write a message to STDOUT without a name attached
# 1: That message
[ -z "$1" ] && return 1 [ -z "$1" ] && return 1
printf "%s\\n" \ printf "%s\\n" \
"$1" "$1"
} }
log() { log() {
# Write a message to STDOUT # Write a message to STDOUT
# 1: That message
[ -z "$1" ] && return 1 [ -z "$1" ] && return 1
printf "%s log: %s\\n" \ printf "%s log: %s\\n" \
"$_name" \ "$_name" \
@ -32,6 +34,8 @@ log() {
} }
err() { err() {
# Write a message to STDERR, also exit if arg 2 is specified # Write a message to STDERR, also exit if arg 2 is specified
# 1: That message
# 2: An optional exit code (will only exit if provided)
[ -z "$1" ] && return 1 [ -z "$1" ] && return 1
printf "%s err: %s\\n" \ printf "%s err: %s\\n" \
"$_name" \ "$_name" \
@ -44,11 +48,14 @@ err() {
fi fi
} }
has() { has() {
# See if a program exists in $PATH
# 1: A program
[ -z "$1" ] && return 1 [ -z "$1" ] && return 1
command -v "$1" > /dev/null 2>&1 command -v "$1" > /dev/null 2>&1
} }
gettarget() { gettarget() {
# Parse a defaults file to get the target program # Parse a defaults file to get the target program
# 1: A defaults file
[ -z "$1" ] && return 1 [ -z "$1" ] && return 1
[ -r "$1" ] || return 1 [ -r "$1" ] || return 1
# Every odd line is the check line # Every odd line is the check line