Skip to content

Commit

Permalink
Merge pull request #206 from dxw/add-log-info-function
Browse files Browse the repository at this point in the history
Add `log_info` bash function
  • Loading branch information
Stretch96 authored Nov 14, 2023
2 parents 1854394 + 70ba908 commit 66656aa
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions lib/bash-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,34 @@ function err {
echo "[!] Error: $*" >&2
}

# Set up a handy log output function
#
# @usage log_info -l 'Something happened :)'"
# @param -l <log> Any information to output
# @param -q <0/1> Quiet mode
function log_info {
OPTIND=1
QUIET_MODE=0
while getopts "l:q:" opt; do
case $opt in
l)
LOG="$OPTARG"
;;
q)
QUIET_MODE="$OPTARG"
;;
*)
echo "Invalid \`log_info\` function usage" >&2
exit 1
;;
esac
done
if [ "$QUIET_MODE" == "0" ]
then
echo "==> $LOG"
fi
}

# Check to see if a binary is installed on the system
#
# @usage is_installed "oathtool"
Expand Down

0 comments on commit 66656aa

Please sign in to comment.