Add missing option spec
[khatus.git] / bin / khatus_show
index 12263e1..5170492 100755 (executable)
@@ -6,7 +6,7 @@ BIN=$HOME/bin
 STATUS_DIR=$HOME/var/run/status
 STATUS_FILE__WIFI=$STATUS_DIR/wifi
 STATUS_FILE__ENERGY_NOTIFIED_BELLOW_HALF=$STATUS_DIR/notified_energy_bellow_half
-while getopts ":b:d:s:" opt
+while getopts ":b:d:s:i:w:" opt
 do
     case "$opt" in
         b)
@@ -18,6 +18,12 @@ do
         s)
             DISK_SPACE_DEVICE="$OPTARG"
             ;;
+        i)
+            PREFIXES_OF_INTERFACES_TO_SHOW="$OPTARG"
+            ;;
+        w)
+            WEATHER_STATION_ID="$OPTARG"
+            ;;
         \?)
             echo "Unknown option: $OPTARG" >&2
             exit 1
@@ -31,6 +37,7 @@ done
 if [ "$SCREEN_BRIGHTNESS_DEVICE_NAME" == '' ]; then echo 'Missing -b' >&2; exit 1; fi
 if [ "$DISK_IO_DEVICE" == '' ];                then echo 'Missing -d' >&2; exit 1; fi
 if [ "$DISK_SPACE_DEVICE" == '' ];             then echo 'Missing -s' >&2; exit 1; fi
+if [ "$WEATHER_STATION_ID" == '' ];            then echo 'Missing -w' >&2; exit 1; fi
 SCREEN_BRIGHTNESS_DEVICE_PATH="/sys/class/backlight/$SCREEN_BRIGHTNESS_DEVICE_NAME"
 
 
@@ -127,7 +134,7 @@ network=$(
     ip -s addr \
     | awk \
         -v wifi_conn="$(cat $STATUS_FILE__WIFI)" \
-        -v prefixes_of_interfaces_to_show='w' \
+        -v prefixes_of_interfaces_to_show="$PREFIXES_OF_INTERFACES_TO_SHOW" \
         '
         BEGIN {
             bytes_per_unit = 1024 * 1024
@@ -401,7 +408,11 @@ else
     rm -f "$STATUS_FILE__ENERGY_NOTIFIED_BELLOW_HALF"
 fi
 
-weather=$(awk 'NR == 1 {printf("%s°F", $1)}' ~/var/run/metar-KJFK-decoded-temp-fahrenheit)
+weather=$(
+    awk \
+        'NR == 1 {printf("%s°F", $1)}' \
+        "$HOME/var/run/metar-${WEATHER_STATION_ID}-decoded-temp-fahrenheit"
+)
 
 #signal_last_msg_age=$(
 #    ls -lt --time-style=+%s $HOME/var/lib/signal/latest_message.json \
This page took 0.023257 seconds and 4 git commands to generate.