Update `_debug` and `_die` comments.

This commit is contained in:
William Melody 2015-06-27 20:21:58 -07:00
parent 3cfa2c8cf9
commit 66edbfd03c
1 changed files with 14 additions and 14 deletions

28
hosts
View File

@ -55,12 +55,12 @@ HOSTS_PATH="${HOSTS_PATH:-/etc/hosts}"
# _debug()
#
# A simple function for executing a specified command if the `_use_debug`
# variable has been set. The command is expected to print a message and
# should typically be either `echo`, `printf`, or `cat`.
#
# Usage:
# _debug printf "Debug info. Variable: %s\n" "$0"
#
# A simple function for executing a specified command if the `$_USE_DEBUG`
# variable has been set. The command is expected to print a message and
# should typically be either `echo`, `printf`, or `cat`.
_debug() {
if [[ "${_use_debug:-"0"}" -eq 1 ]]; then
# Prefix debug message with "bug (U+1F41B)"
@ -71,12 +71,12 @@ _debug() {
}
# debug()
#
# Print the specified message if the `_use_debug` variable has been set.
#
# This is a shortcut for the _debug() function that simply echos the message.
#
# Usage:
# debug "Debug info. Variable: $0"
#
# Print the specified message if the `$_USE_DEBUG` variable has been set.
#
# This is a shortcut for the _debug() function that simply echos the message.
debug() {
_debug echo "$@"
}
@ -87,12 +87,12 @@ debug() {
# _die()
#
# Usage:
# _die printf "Error message. Variable: %s\n" "$0"
#
# A simple function for exiting with an error after executing the specified
# command. The command is expected to print a message and should typically
# be either `echo`, `printf`, or `cat`.
#
# Usage:
# _die printf "Error message. Variable: %s\n" "$0"
_die() {
# Prefix die message with "cross mark (U+274C)", often displayed as a red x.
printf "❌ "
@ -101,12 +101,12 @@ _die() {
}
# die()
#
# Usage:
# die "Error message. Variable: $0"
#
# Exit with an error and print the specified message.
#
# This is a shortcut for the _die() function that simply echos the message.
#
# Usage:
# die "Error message. Variable: $0"
die() {
_die echo "$@"
}