Removed @example blocks because shdoc was failing

This commit is contained in:
Brian Zalewski 2024-02-15 05:26:03 +00:00
parent 066c1f36fb
commit 53de94b339
13 changed files with 1 additions and 110 deletions

View file

@ -25,7 +25,6 @@
# If the `docker` environment variable is not set, the script / library will ensure both Gum and Glow are installed.
# @description Installs glow (a markdown renderer) from GitHub releases
# @example installGlow
installGlow() {
# TODO: Add support for other architecture types
if [ -d '/Applications' ] && [ -d '/Library' ] && [ -d '/Users' ]; then
@ -57,7 +56,6 @@ installGlow() {
}
# @description Installs gum (a logging CLI) from GitHub releases
# @example installGum
installGum() {
# TODO: Add support for other architecture types
if [ -d '/Applications' ] && [ -d '/Library' ] && [ -d '/Users' ]; then
@ -117,7 +115,6 @@ if [ -n "$SEMANTIC_RELEASE" ]; then
fi
# @description Logs using Node.js
# @example logger info "An informative log"
logger() {
if [ "$1" == 'error' ]; then
"$GUM_PATH" style --border="thick" "$("$GUM_PATH" style --foreground="#ff0000" "✖") $("$GUM_PATH" style --bold --background="#ff0000" --foreground="#ffffff" " ERROR ") $("$GUM_PATH" style --bold "$(format "$2")")"
@ -171,7 +168,6 @@ format() {
}
# @description Display prompt that allows you to choose between options
# @example RESPONSE="$(.config/log choose "file.png" "another-file.jpg")"
choose() {
if type gum &> /dev/null; then
CHOOSE_ARGS="gum choose"
@ -185,7 +181,6 @@ choose() {
}
# @description Display a confirmation prompt that returns an exit code if "No" is selected
# @example RESPONSE="$(.config/log confirm "Are you sure?" "Yeah" "Naa")"
confirm() {
if type gum &> /dev/null; then
GUM_OPTS=""
@ -211,7 +206,6 @@ confirm() {
}
# @description Logs an error message
# @example .config/log error "Something happened!"
error() {
if [ -z "$NO_LOGGING" ]; then
if [ -n "$ENHANCED_LOGGING" ]; then
@ -223,7 +217,6 @@ error() {
}
# @description Display a filterable prompt that is populated with options from a text file
# @example echo Strawberry >> flavors.text && echo Banana >> flavors.text && RESPONSE="$(.config/log filter flavors.txt)"
filter() {
if type gum &> /dev/null; then
TMP="$(mktemp)"
@ -234,7 +227,6 @@ filter() {
}
# @description Logs an info message
# @example .config/log info "Here is some information"
info() {
if [ -z "$NO_LOGGING" ]; then
if [ -n "$ENHANCED_LOGGING" ]; then
@ -246,7 +238,6 @@ info() {
}
# @description Displays an input with masked characters
# @example INPUT="$(.config/log input 'Enter the value..')"
input() {
if type gum &> /dev/null; then
if [ -n "$1" ]; then
@ -260,8 +251,6 @@ input() {
}
# @description Logs a message written in markdown
# @example .config/log md "[styled_link](https://google.com)"
# @example .config/log md mymarkdown/file.md
md() {
if [ ! -f "$1" ]; then
echo "ERROR: A markdown file must be passed in as the parameter" && exit 1
@ -272,7 +261,6 @@ md() {
}
# @description Displays an input with masked characters
# @example PASSWORD="$(.config/log password 'Enter the Ansible vault password')"
password() {
if type gum &> /dev/null; then
if [ -n "$1" ]; then
@ -286,7 +274,6 @@ password() {
}
# @description Logs a message that describes a prompt
# @example .config/log prompt "Enter text into the following prompt"
prompt() {
if [ -z "$NO_LOGGING" ]; then
if [ -n "$ENHANCED_LOGGING" ]; then
@ -298,7 +285,6 @@ prompt() {
}
# @description Display a spinner that stays until a command is completed
# @example .config/log spin "brew install yq" "Installing yq..")"
spin() {
if type gum &> /dev/null; then
if [ -n "$1" ] && [ -n "$2" ]; then
@ -314,7 +300,6 @@ spin() {
}
# @description Logs a message that starts with a star emoji
# @example .config/log star "Congratulations"
star() {
if [ -z "$NO_LOGGING" ]; then
if [ -n "$ENHANCED_LOGGING" ]; then
@ -326,7 +311,6 @@ star() {
}
# @description Logs a message at the beginning of a task
# @example .config/log start "Starting the process.."
start() {
if [ -z "$NO_LOGGING" ]; then
if [ -n "$ENHANCED_LOGGING" ]; then
@ -338,7 +322,6 @@ start() {
}
# @description Logs a success message
# @example .config/log success "Yay!"
success() {
if [ -z "$NO_LOGGING" ]; then
if [ -n "$ENHANCED_LOGGING" ]; then
@ -350,7 +333,6 @@ success() {
}
# @description Logs a warning message
# @example .config/log warn "Just so you know.."
warn() {
if [ -z "$NO_LOGGING" ]; then
if [ -n "$ENHANCED_LOGGING" ]; then
@ -362,7 +344,6 @@ warn() {
}
# @description Displays a multi-line prompt for text input
# @example .config/log write "Write something..")"
write() {
if type gum &> /dev/null; then
if [ -n "$1" ]; then

View file

@ -149,7 +149,6 @@ fi
# @description Logs with style using Gum if it is installed, otherwise it uses `echo`. It also leverages Glow to render markdown.
# When Glow is not installed, it uses `cat`.
# @example logger info "An informative log"
logg() {
TYPE="$1"
MSG="$2"

View file

@ -1,7 +1,6 @@
#!/usr/bin/env bash
# @description Installs glow (a markdown renderer) from GitHub releases
# @example installGlow
installGlow() {
# TODO: Add support for other architecture types
if [ -d '/Applications' ] && [ -d '/Library' ] && [ -d '/Users' ]; then
@ -33,7 +32,6 @@ installGlow() {
}
# @description Installs gum (a logging CLI) from GitHub releases
# @example installGum
installGum() {
# TODO: Add support for other architecture types
if [ -d '/Applications' ] && [ -d '/Library' ] && [ -d '/Users' ]; then
@ -120,7 +118,6 @@ formatFaint() {
}
# @description Logs using Gum
# @example logger info "An informative log"
logg() {
TYPE="$1"
MSG="$2"

View file

@ -220,9 +220,7 @@ alias recoverpy='python3 -m recoverpy'
alias perftest='mkdir -p "${XDG_DATA_HOME:-$HOME/.local/share}/perftest" && curl -sL yabs.sh | bash -s -- -w "${XDG_DATA_HOME:-$HOME/.local/share}/perftest/$(date +%Y%m%d_%H%M%S)"'
# @description Adds an alias to use Docker to run [pfFocus](https://github.com/TKCERT/pfFocus) which is a Python package that
# allows you to convert a pfSense export into a readable markdown file.
# @example
# pf-format < input.xml > output.md
# allows you to convert a pfSense export into a readable markdown file. Example: `pf-format < input.xml > output.md`
function pf-format() {
docker run --rm -i ghcr.io/tkcert/pffocus "$*"
}

View file

@ -25,7 +25,6 @@
# If the `docker` environment variable is not set, the script / library will ensure both Gum and Glow are installed.
# @description Installs glow (a markdown renderer) from GitHub releases
# @example installGlow
installGlow() {
# TODO: Add support for other architecture types
if [ -d '/Applications' ] && [ -d '/Library' ] && [ -d '/Users' ]; then
@ -57,7 +56,6 @@ installGlow() {
}
# @description Installs gum (a logging CLI) from GitHub releases
# @example installGum
installGum() {
# TODO: Add support for other architecture types
if [ -d '/Applications' ] && [ -d '/Library' ] && [ -d '/Users' ]; then
@ -120,7 +118,6 @@ if [ -n "$SEMANTIC_RELEASE" ]; then
fi
# @description Logs using Gum
# @example logger info "An informative log"
logger() {
TYPE="$1"
MSG="$2"
@ -198,7 +195,6 @@ formatFaint() {
}
# @description Display prompt that allows you to choose between options
# @example RESPONSE="$(.config/log choose "file.png" "another-file.jpg")"
choose() {
if type gum &> /dev/null; then
CHOOSE_ARGS="gum choose"
@ -212,7 +208,6 @@ choose() {
}
# @description Display a confirmation prompt that returns an exit code if "No" is selected
# @example RESPONSE="$(.config/log confirm "Are you sure?" "Yeah" "Naa")"
confirm() {
if type gum &> /dev/null; then
GUM_OPTS=""
@ -238,7 +233,6 @@ confirm() {
}
# @description Logs an error message
# @example .config/log error "Something happened!"
error() {
if [ -z "$NO_LOGGING" ]; then
if [ -n "$ENHANCED_LOGGING" ]; then
@ -250,7 +244,6 @@ error() {
}
# @description Display a filterable prompt that is populated with options from a text file
# @example echo Strawberry >> flavors.text && echo Banana >> flavors.text && RESPONSE="$(.config/log filter flavors.txt)"
filter() {
if type gum &> /dev/null; then
TMP="$(mktemp)"
@ -261,7 +254,6 @@ filter() {
}
# @description Logs an info message
# @example .config/log info "Here is some information"
info() {
if [ -z "$NO_LOGGING" ]; then
if [ -n "$ENHANCED_LOGGING" ]; then
@ -273,7 +265,6 @@ info() {
}
# @description Displays an input with masked characters
# @example INPUT="$(.config/log input 'Enter the value..')"
input() {
if type gum &> /dev/null; then
if [ -n "$1" ]; then
@ -287,8 +278,6 @@ input() {
}
# @description Logs a message written in markdown
# @example .config/log md "[styled_link](https://google.com)"
# @example .config/log md mymarkdown/file.md
md() {
if [ ! -f "$1" ]; then
echo "ERROR: A markdown file must be passed in as the parameter" && exit 1
@ -299,7 +288,6 @@ md() {
}
# @description Displays an input with masked characters
# @example PASSWORD="$(.config/log password 'Enter the Ansible vault password')"
password() {
if type gum &> /dev/null; then
if [ -n "$1" ]; then
@ -313,7 +301,6 @@ password() {
}
# @description Logs a message that describes a prompt
# @example .config/log prompt "Enter text into the following prompt"
prompt() {
if [ -z "$NO_LOGGING" ]; then
if [ -n "$ENHANCED_LOGGING" ]; then
@ -325,7 +312,6 @@ prompt() {
}
# @description Display a spinner that stays until a command is completed
# @example .config/log spin "brew install yq" "Installing yq..")"
spin() {
if type gum &> /dev/null; then
if [ -n "$1" ] && [ -n "$2" ]; then
@ -341,7 +327,6 @@ spin() {
}
# @description Logs a message that starts with a star emoji
# @example .config/log star "Congratulations"
star() {
if [ -z "$NO_LOGGING" ]; then
if [ -n "$ENHANCED_LOGGING" ]; then
@ -353,7 +338,6 @@ star() {
}
# @description Logs a message at the beginning of a task
# @example .config/log start "Starting the process.."
start() {
if [ -z "$NO_LOGGING" ]; then
if [ -n "$ENHANCED_LOGGING" ]; then
@ -365,7 +349,6 @@ start() {
}
# @description Logs a success message
# @example .config/log success "Yay!"
success() {
if [ -z "$NO_LOGGING" ]; then
if [ -n "$ENHANCED_LOGGING" ]; then
@ -377,7 +360,6 @@ success() {
}
# @description Logs a warning message
# @example .config/log warn "Just so you know.."
warn() {
if [ -z "$NO_LOGGING" ]; then
if [ -n "$ENHANCED_LOGGING" ]; then
@ -389,7 +371,6 @@ warn() {
}
# @description Displays a multi-line prompt for text input
# @example .config/log write "Write something..")"
write() {
if type gum &> /dev/null; then
if [ -n "$1" ]; then

View file

@ -50,7 +50,6 @@ fi
# @description Logs with style using Gum if it is installed, otherwise it uses `echo`. It also leverages Glow to render markdown.
# When Glow is not installed, it uses `cat`.
# @example logger info "An informative log"
logg() {
TYPE="$1"
MSG="$2"

View file

@ -64,10 +64,6 @@
# | `start` | Same as `success` |
# | `success` | Logs a success message that starts with green checkmark |
# | `warn` | Logs a bright yellow warning message |
# @example
# logger info "An informative log"
# @example
# logger md ~/README.md
logg() {
TYPE="$1"
MSG="$2"

View file

@ -55,10 +55,6 @@
# | `start` | Same as `success` |
# | `success` | Logs a success message that starts with green checkmark |
# | `warn` | Logs a bright yellow warning message |
# @example
# logger info "An informative log"
# @example
# logger md ~/README.md
logg() {
TYPE="$1"
MSG="$2"

View file

@ -24,10 +24,6 @@
# | `start` | Same as `success` |
# | `success` | Logs a success message that starts with green checkmark |
# | `warn` | Logs a bright yellow warning message |
# @example
# logger info "An informative log"
# @example
# logger md ~/README.md
logg() {
TYPE="$1"
MSG="$2"

View file

@ -11,10 +11,6 @@
# | `start` | Same as `success` |
# | `success` | Logs a success message that starts with green checkmark |
# | `warn` | Logs a bright yellow warning message |
# @example
# logger info "An informative log"
# @example
# logger md ~/README.md
logg() {
TYPE="$1"
MSG="$2"

View file

@ -31,10 +31,6 @@
# | `start` | Same as `success` |
# | `success` | Logs a success message that starts with green checkmark |
# | `warn` | Logs a bright yellow warning message |
# @example
# logger info "An informative log"
# @example
# logger md ~/README.md
logg() {
TYPE="$1"
MSG="$2"

View file

@ -64,10 +64,6 @@
# | `start` | Same as `success` |
# | `success` | Logs a success message that starts with green checkmark |
# | `warn` | Logs a bright yellow warning message |
# @example
# logger info "An informative log"
# @example
# logger md ~/README.md
logg() {
TYPE="$1"
MSG="$2"

View file

@ -49,11 +49,6 @@ else
fi
# @description Caches values from commands
#
# @example
# cache brew --prefix golang
#
# @arg The command to run
function cache() {
local DIR="${CACHE_DIR:-.cache}"
if ! test -d "$DIR"; then
@ -67,11 +62,6 @@ function cache() {
}
# @description Formats log statements
#
# @example
# format 'Message to be formatted'
#
# @arg $1 string The message to be formatted
function format() {
# shellcheck disable=SC2001,SC2016
ANSI_STR="$(echo "$1" | sed 's/^\([^`]*\)`\([^`]*\)`/\1\\e[100;1m \2 \\e[0;39m/')"
@ -82,12 +72,6 @@ function format() {
}
# @description Proxy function for handling logs in this script
#
# @example
# logger warn "Warning message"
#
# @arg $1 string The type of log message (can be info, warn, success, or error)
# @arg $2 string The message to log
function logger() {
if [ -f .config/log ]; then
.config/log "$1" "$2"
@ -156,9 +140,6 @@ function ensureRedHatPackageInstalled() {
# @description Installs package when user is root on Linux
#
# @example
# ensureRootPackageInstalled "sudo"
#
# @arg $1 string The name of the package that must be present
#
# @exitcode 0 The package was successfully installed
@ -201,9 +182,6 @@ fi
# @description Ensures ~/.local/bin is in the PATH variable on *nix machines and
# exits with an error on unsupported OS types
#
# @example
# ensureLocalPath
#
# @set PATH string The updated PATH with a reference to ~/.local/bin
#
# @noarg
@ -230,9 +208,6 @@ function ensureLocalPath() {
# @description Ensures given package is installed on a system.
#
# @example
# ensurePackageInstalled "curl"
#
# @arg $1 string The name of the package that must be present
#
# @exitcode 0 The package(s) were successfully installed
@ -275,9 +250,6 @@ function ensurePackageInstalled() {
# @description Ensures the latest version of Task is installed to `/usr/local/bin` (or `~/.local/bin`, as
# a fallback.
#
# @example
# ensureTaskInstalled
#
# @noarg
#
# @exitcode 0 If the package is already present and up-to-date or if it was installed/updated
@ -339,9 +311,6 @@ function ensureTaskInstalled() {
#
# @see ensureTaskInstalled
#
# @example
# installTask
#
# @noarg
#
# @exitcode 0 If Task installs/updates properly
@ -398,9 +367,6 @@ function installTask() {
# @description Verifies the SHA256 checksum of a file
#
# @example
# sha256 myfile.tar.gz 5b30f9c042553141791ec753d2f96786c60a4968fd809f75bb0e8db6c6b4529b
#
# @arg $1 string Path to the file
# @arg $2 string The SHA256 signature
#
@ -443,9 +409,6 @@ function sha256() {
}
# @description Ensures the Taskfile.yml is accessible
#
# @example
# ensureTaskfiles
function ensureTaskfiles() {
if [ -z "$ENSURED_TASKFILES" ]; then
# shellcheck disable=SC2030
@ -504,9 +467,6 @@ function ensureTaskfiles() {
}
# @description Ensures basic files like package.json and Taskfile.yml are present
#
# @example
# ensureProjectBootstrapped
function ensureProjectBootstrapped() {
if [ ! -f start.sh ] || [ ! -f package.json ] || [ ! -f Taskfile.yml ]; then
if [ ! -f start.sh ]; then