A few updates, cleanup updated weather module.
This commit is contained in:
@@ -1,12 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
[ -f functions.sh ] && source functions.sh
|
||||
|
||||
fortune="$(command -v fortune)"
|
||||
# Dependencies required by this module
|
||||
dependencies=("fortune")
|
||||
|
||||
target="${3#fortune}"
|
||||
|
||||
if [ -z "$fortune" ]; then
|
||||
msg "$2" "I do not have access to fortune."
|
||||
else
|
||||
fortuneText="$($fortune -a -e -s -n 512 $target || echo "No fortunes found.")"
|
||||
# Check dependencies before running
|
||||
if ! check_dependencies "${dependencies[@]}"; then
|
||||
msg "$2" "$1: This module requires: ${dependencies[*]}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
fortuneText="$(fortune -a -e -s -n 512 $target || echo "No fortunes found.")"
|
||||
fortuneText="$(echo "$fortuneText" | tr '[:space:]' ' ' | sed -e 's/"/\"/g')"
|
||||
msg "$2" "$fortuneText"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user