ref: fbc6bc4fd52bd02c18a7b0cf0f4a4c113e8f27b5
parent: 64b336b2488cbb42d73b2fead4222c6c20f598f5
author: sl <sl@x1yg3>
date: Sat Jul 5 22:37:44 EDT 2025
add weather
--- a/INDEX
+++ b/INDEX
@@ -31,6 +31,7 @@
top - approximates the top command on unix (author unknown)
tpl - Create tangara playlists in matching directories under ../Playlists/.
trackpoint - Set preferred X11 mouse acceleration for ThinkPad trackpoint.
+weather - print weather report in text or png of ascii art (by Fulton Browne)
wircrc - rio irc client (by cinap_lenrek)
vtb - run vt -b with proper size fonts
zombie - launch uxn/zombie.rom
--- /dev/null
+++ b/weather
@@ -1,0 +1,35 @@
+#!/bin/rc
+# weather(1) - by Fulton Browne - MIT Licence
+
+rfork e
+
+DEFAULT=Indianapolis
+p = 'no'
+
+fn usage{
+ echo 'usage: weather [-p] [location]' >[1=2]
+ exit usage
+}
+while (~ $1 -*){
+ switch($1){
+ case '-p'
+ p='yes'
+ shift
+ case *
+ usage
+ }
+}
+switch($#*){
+case 0
+ arg=$DEFAULT
+ if(~ $#weather 1)
+ arg=$weather
+case 1
+ arg=$1
+case *
+ usage
+}
+
+if (~ $p 'no') hget 'http://wttr.in/'$arg'?u&format=%25t%20%25C'
+if not hget http://wttr.in/~$arg.png'?'u | page
+echo
--
⑨