mirror of
https://github.com/casjaysdevdocker/vim
synced 2025-09-19 03:57:39 -04:00
🦈🏠🐜❗ Initial Commit ❗🐜🦈🏠
This commit is contained in:
85
bin/weather
Executable file
85
bin/weather
Executable file
@@ -0,0 +1,85 @@
|
||||
#!/usr/bin/env sh
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
##@Version : 202207060010-git
|
||||
# @Author : Jason Hempstead
|
||||
# @Contact : jason@casjaysdev.com
|
||||
# @License : LICENSE.md
|
||||
# @ReadME : weather --help
|
||||
# @Copyright : Copyright: (c) 2022 Jason Hempstead, Casjays Developments
|
||||
# @Created : Wednesday, Jul 06, 2022 00:10 EDT
|
||||
# @File : weather
|
||||
# @Description : get weather - used by tmux
|
||||
# @TODO :
|
||||
# @Other :
|
||||
# @Resource :
|
||||
# @sudo/root : no
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
PROG="$(basename "$0" 2>/dev/null)"
|
||||
USER="${SUDO_USER:-${USER}}"
|
||||
HOME="${USER_HOME:-${HOME}}"
|
||||
SRC_DIR="$(dirname "$PROG")"
|
||||
VERSION="202207060012-git"
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Set bash options
|
||||
if [ "$1" = "--debug" ]; then shift 1 && set -xo && export SCRIPT_OPTS="--debug" && export _DEBUG="on"; fi
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Check for needed applications
|
||||
#type -P sh &>/dev/null || exit 1 # exit if not found
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Set variables
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Set functions
|
||||
__version() { echo "$VERSION"; }
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Set additional variables
|
||||
exitCode=""
|
||||
GEN_SCRIPT_ARRAY_DIR="$HOME/.config/weather"
|
||||
WEATHER_CONFIG_DIR="$HOME/.config/weather"
|
||||
WEATHER_CONFIG_FILE="settings.conf"
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# bring in user config
|
||||
[ -f "$WEATHER_CONFIG_DIR/$WEATHER_CONFIG_FILE" ] && . "$WEATHER_CONFIG_DIR/$WEATHER_CONFIG_FILE"
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Argument/Option settings
|
||||
SETARGS="$*"
|
||||
SHORTOPTS="v,h"
|
||||
LONGOPTS="options,config,version,help"
|
||||
ARRAY=""
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Setup application options
|
||||
setopts=$(getopt -o "$SHORTOPTS" --long "$LONGOPTS" -n "$APPNAME" -- "$@" 2>/dev/null)
|
||||
eval set -- "${setopts}" 2>/dev/null
|
||||
while :; do
|
||||
case $1 in
|
||||
--version)
|
||||
shift 1
|
||||
__version
|
||||
;;
|
||||
--help)
|
||||
shift 1
|
||||
printf 'Display current weather in your terminal'
|
||||
;;
|
||||
--config)
|
||||
shift 1
|
||||
__gen_config
|
||||
;;
|
||||
--)
|
||||
shift 1
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Main application
|
||||
curl -q -LSsf "http://wttr.in/?format=3" | awk '{print $1,$(NF-1),$NF}' | sed 's|, |: |g' || echo N/A
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# End application
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# lets exit with code
|
||||
exit ${exitCode:-$?}
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# end
|
Reference in New Issue
Block a user