Reorganization to hopefully prevent git conflicts.

This commit is contained in:
Storm Dragon
2025-10-25 01:30:02 -04:00
parent f6990bcc81
commit d684623974
13 changed files with 296 additions and 77 deletions

View File

@@ -5,6 +5,9 @@
dependencies=("fortune")
target="${3#fortune}"
# Trim leading/trailing whitespace
target="${target#"${target%%[![:space:]]*}"}"
target="${target%"${target##*[![:space:]]}"}"
# Check dependencies before running
if ! check_dependencies "${dependencies[@]}"; then
@@ -12,6 +15,7 @@ if ! check_dependencies "${dependencies[@]}"; then
exit 1
fi
fortuneText="$(fortune -a -e -s -n 512 $target || echo "No fortunes found.")"
# Quote target to prevent command injection
fortuneText="$(fortune -a -e -s -n 512 "$target" || echo "No fortunes found.")"
fortuneText="$(echo "$fortuneText" | tr '[:space:]' ' ' | sed -e 's/"/\"/g')"
msg "$2" "$fortuneText"