mirror of
https://github.com/octoleo/hosts.git
synced 2024-11-25 22:27:42 +00:00
Update _debug
and _die
comments.
This commit is contained in:
parent
3cfa2c8cf9
commit
66edbfd03c
28
hosts
28
hosts
@ -55,12 +55,12 @@ HOSTS_PATH="${HOSTS_PATH:-/etc/hosts}"
|
|||||||
|
|
||||||
# _debug()
|
# _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:
|
# Usage:
|
||||||
# _debug printf "Debug info. Variable: %s\n" "$0"
|
# _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() {
|
_debug() {
|
||||||
if [[ "${_use_debug:-"0"}" -eq 1 ]]; then
|
if [[ "${_use_debug:-"0"}" -eq 1 ]]; then
|
||||||
# Prefix debug message with "bug (U+1F41B)"
|
# Prefix debug message with "bug (U+1F41B)"
|
||||||
@ -71,12 +71,12 @@ _debug() {
|
|||||||
}
|
}
|
||||||
# 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:
|
# Usage:
|
||||||
# debug "Debug info. Variable: $0"
|
# 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() {
|
||||||
_debug echo "$@"
|
_debug echo "$@"
|
||||||
}
|
}
|
||||||
@ -87,12 +87,12 @@ debug() {
|
|||||||
|
|
||||||
# _die()
|
# _die()
|
||||||
#
|
#
|
||||||
|
# Usage:
|
||||||
|
# _die printf "Error message. Variable: %s\n" "$0"
|
||||||
|
#
|
||||||
# A simple function for exiting with an error after executing the specified
|
# A simple function for exiting with an error after executing the specified
|
||||||
# command. The command is expected to print a message and should typically
|
# command. The command is expected to print a message and should typically
|
||||||
# be either `echo`, `printf`, or `cat`.
|
# be either `echo`, `printf`, or `cat`.
|
||||||
#
|
|
||||||
# Usage:
|
|
||||||
# _die printf "Error message. Variable: %s\n" "$0"
|
|
||||||
_die() {
|
_die() {
|
||||||
# Prefix die message with "cross mark (U+274C)", often displayed as a red x.
|
# Prefix die message with "cross mark (U+274C)", often displayed as a red x.
|
||||||
printf "❌ "
|
printf "❌ "
|
||||||
@ -101,12 +101,12 @@ _die() {
|
|||||||
}
|
}
|
||||||
# die()
|
# die()
|
||||||
#
|
#
|
||||||
|
# Usage:
|
||||||
|
# die "Error message. Variable: $0"
|
||||||
|
#
|
||||||
# Exit with an error and print the specified message.
|
# Exit with an error and print the specified message.
|
||||||
#
|
#
|
||||||
# This is a shortcut for the _die() function that simply echos the message.
|
# This is a shortcut for the _die() function that simply echos the message.
|
||||||
#
|
|
||||||
# Usage:
|
|
||||||
# die "Error message. Variable: $0"
|
|
||||||
die() {
|
die() {
|
||||||
_die echo "$@"
|
_die echo "$@"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user