generated from me/template-mit
Compare commits
9
Commits
cde66dcd67
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
acb4f38f71 | ||
|
|
41c80130d5 | ||
|
|
5bb9e51bfe | ||
|
|
0ccd900219 | ||
|
|
f433cd87a8 | ||
|
|
68aba793b9 | ||
|
|
b3d3573fae | ||
|
|
bd02d4611a | ||
|
|
d70c5d3069 |
No files matched your search
@@ -1,3 +1,19 @@
|
|||||||
# template-mit
|
# Nomadic Weather
|
||||||
|
|
||||||
Template with MIT license, protected `main` branch, and available `dev` branch.
|
See the [wiki](https://git.hyperling.com/me/nomadic-weather/wiki) for more information.
|
||||||
|
|
||||||
|
## cli
|
||||||
|
|
||||||
|
Programs made while testing with the API endpoint.
|
||||||
|
|
||||||
|
## doc
|
||||||
|
|
||||||
|
Documentation.
|
||||||
|
|
||||||
|
## gui
|
||||||
|
|
||||||
|
Flutter project directed at Android and Linux.
|
||||||
|
|
||||||
|
## srv
|
||||||
|
|
||||||
|
Backend code.
|
||||||
File renamed without changes.
@@ -0,0 +1,18 @@
|
|||||||
|
# Nomadic Weather CLI
|
||||||
|
|
||||||
|
Prototype for playing with [Open-Meteo](https://open-meteo.com).
|
||||||
|
|
||||||
|
Locations need modified manually since it's still just a prototype.
|
||||||
|
|
||||||
|
## prototype.js
|
||||||
|
|
||||||
|
Got a little carried away and made it pretty formal.
|
||||||
|
Still a prototype though since the locations are hardcoded.
|
||||||
|
Would be made more complete by accepting a list of values, an env file,
|
||||||
|
or basically just any way of handling the locations as user input.
|
||||||
|
|
||||||
|
## install.sh
|
||||||
|
|
||||||
|
Allows the script to be installed either in ~/bin/ or /usr/local/bin/.
|
||||||
|
Also handles removal if it is no longer wanted.
|
||||||
|
Currently does not remove from /usr/local/src/.
|
||||||
Whitespace-only changes.
Whitespace-only changes.
Executable
+110
@@ -0,0 +1,110 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# 20260912 - Hyperling
|
||||||
|
# "Install" script to get this program runnable from anywhere on the system.
|
||||||
|
|
||||||
|
## Variables ##
|
||||||
|
|
||||||
|
DIR="$(cd "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
|
||||||
|
PROG="$(basename -- "${BASH_SOURCE[0]}")"
|
||||||
|
LOCAL=~/bin
|
||||||
|
GLOBAL=/usr/local/bin
|
||||||
|
GLOBAL_SRC=/usr/local/src
|
||||||
|
|
||||||
|
name_local="prototype.js"
|
||||||
|
name_short="nomad"
|
||||||
|
name_long="nomadic-weather"
|
||||||
|
name_abs="weather-list"
|
||||||
|
|
||||||
|
## Functions ##
|
||||||
|
|
||||||
|
function usage {
|
||||||
|
cat <<- EOF
|
||||||
|
$PROG [-h] [-g] [a|l|s] [-r]
|
||||||
|
|
||||||
|
Install $name_local to the system. Can be local, global, or removed.
|
||||||
|
|
||||||
|
Parameters)
|
||||||
|
h) Display this message.
|
||||||
|
g) Install globally ($GLOBAL), otherwise local ($LOCAL).
|
||||||
|
a) Abstract name, unrelated to being nomadic. ($name_abs)
|
||||||
|
l) Long name, the full name of the project. ($name_long)
|
||||||
|
s) Short name, the full name of the project. ($name_short)
|
||||||
|
r) Remove / uninstall the project according to the above flags.
|
||||||
|
|
||||||
|
Examples)
|
||||||
|
- Install to the local user with the abstract name.
|
||||||
|
$PROG
|
||||||
|
- Install to all users with all names.
|
||||||
|
$PROG -alsg
|
||||||
|
- Remove all instances.
|
||||||
|
$PROG -alsr && $PROG -alsrg
|
||||||
|
|
||||||
|
Happy weather watching! :)
|
||||||
|
|
||||||
|
~ Hyperling
|
||||||
|
EOF
|
||||||
|
exit $1
|
||||||
|
}
|
||||||
|
|
||||||
|
## Parameters ##
|
||||||
|
|
||||||
|
while getopts ":gslarh" arg; do
|
||||||
|
case $arg in
|
||||||
|
g) global="Y" ;;
|
||||||
|
s) short="Y" ;;
|
||||||
|
l) long="Y" ;;
|
||||||
|
a) abstract="Y" ;;
|
||||||
|
r) remove="Y" ;;
|
||||||
|
h) usage ;;
|
||||||
|
*) echo "ERROR: Parameter $OPTARG was not recognized." && usage 1 ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
## Processing ##
|
||||||
|
|
||||||
|
name=""
|
||||||
|
if [[ "$short" == "Y" ]]; then
|
||||||
|
name="$name $name_short"
|
||||||
|
fi
|
||||||
|
if [[ "$long" == "Y" ]]; then
|
||||||
|
name="$name $name_long"
|
||||||
|
fi
|
||||||
|
if [[ "$abstract" == "Y" || ( -z "$short" && -z "$long" ) ]]; then
|
||||||
|
name="$name $name_abs"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cmd=""
|
||||||
|
dir="$LOCAL"
|
||||||
|
src="$DIR"
|
||||||
|
if [[ "$global" == "Y" ]]; then
|
||||||
|
dir="$GLOBAL"
|
||||||
|
cmd="sudo"
|
||||||
|
echo "Requesting sudo privileges... "
|
||||||
|
sudo echo "Success!"
|
||||||
|
mkdir -pv /usr/local/src
|
||||||
|
sudo cp -Rv "$DIR" $GLOBAL_SRC/
|
||||||
|
src="$GLOBAL_SRC/`basename "$DIR"`"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z "$remove" ]]; then
|
||||||
|
cmd="$cmd ln -svf $src/$name_local"
|
||||||
|
else
|
||||||
|
cmd="$cmd rm -v"
|
||||||
|
fi
|
||||||
|
|
||||||
|
## Main ##
|
||||||
|
|
||||||
|
# Untested
|
||||||
|
#if [[ "$global" == "Y" && "$remove" == "Y" ]]; then
|
||||||
|
# sudo rm -rfv "$src"
|
||||||
|
#fi
|
||||||
|
|
||||||
|
for prog in $name; do
|
||||||
|
mkdir -pv "$dir"
|
||||||
|
$cmd "$dir/$prog"
|
||||||
|
done
|
||||||
|
|
||||||
|
## Finish ##
|
||||||
|
|
||||||
|
echo "Done!"
|
||||||
|
exit 0
|
||||||
File renamed without changes.
File renamed without changes.
Vendored
File renamed without changes.
Whitespace-only changes.
-62
@@ -1,62 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
# 20260912 - Hyperling
|
|
||||||
# "Install" script to get this program runnable from anywhere on the system.
|
|
||||||
|
|
||||||
## Variables ##
|
|
||||||
|
|
||||||
DIR="$(cd "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
|
|
||||||
LOCAL=~/bin
|
|
||||||
GLOBAL=/usr/local/bin
|
|
||||||
|
|
||||||
name_short="nomad"
|
|
||||||
name_long="nomadic-weather"
|
|
||||||
name_abs="weather-list"
|
|
||||||
|
|
||||||
## Functions ##
|
|
||||||
|
|
||||||
## Parameters ##
|
|
||||||
|
|
||||||
while getopts ":gslah" arg; do
|
|
||||||
case $arg in
|
|
||||||
g) global="Y" ;;
|
|
||||||
s) short="Y" ;;
|
|
||||||
l) long="Y" ;;
|
|
||||||
a) abstract="Y" ;;
|
|
||||||
h) usage ;;
|
|
||||||
*) echo "ERROR: Parameter $OPTARG was not recognized." && usage 1 ;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
## Processing ##
|
|
||||||
|
|
||||||
name=""
|
|
||||||
if [[ "$short" == "Y" ]]; then
|
|
||||||
name="$name $name_short"
|
|
||||||
fi
|
|
||||||
if [[ "$long" == "Y" ]]; then
|
|
||||||
name="$name $name_long"
|
|
||||||
fi
|
|
||||||
if [[ "$abstract" == "Y" || ( -z "$short" && -z "$long" ) ]]; then
|
|
||||||
name="$name $name_abs"
|
|
||||||
fi
|
|
||||||
|
|
||||||
cmd=""
|
|
||||||
dir="$LOCAL"
|
|
||||||
if [[ "$global" == "Y" ]]; then
|
|
||||||
dir="$GLOBAL"
|
|
||||||
cmd="sudo"
|
|
||||||
echo "Requesting sudo privileges... "
|
|
||||||
sudo echo "Success!"
|
|
||||||
fi
|
|
||||||
|
|
||||||
## Main ##
|
|
||||||
|
|
||||||
for prog in $name; do
|
|
||||||
mkdir -pv $dir
|
|
||||||
$cmd cp -v -svf "$DIR"/prototype.js $dir/$prog
|
|
||||||
done
|
|
||||||
|
|
||||||
## Finish ##
|
|
||||||
|
|
||||||
echo "Done!"
|
|
||||||
exit 0
|
|
||||||
Reference in new issue
Block a user