about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorelioat <elioat@tilde.institute>2022-12-11 12:23:29 -0500
committerelioat <elioat@tilde.institute>2022-12-11 12:23:29 -0500
commit72d7e6f8625741b60258053ce4716a39437c3736 (patch)
treede0549b779746428faed21757b5e385e6c83f985 /src
parente18a75339da1ee33bd8ba026570bf4d7ed6e8af2 (diff)
downloaddecember-2022-72d7e6f8625741b60258053ce4716a39437c3736.tar.gz
weak sauce safety
Diffstat (limited to 'src')
-rw-r--r--src/catalogue.lil7
-rw-r--r--src/test.csv3
2 files changed, 8 insertions, 2 deletions
diff --git a/src/catalogue.lil b/src/catalogue.lil
index fc62950..0b68c02 100644
--- a/src/catalogue.lil
+++ b/src/catalogue.lil
@@ -14,7 +14,12 @@ on entry d t do
 	# where d is a table representing a new row to be added to t, an existing table
 	date_fmt_string:"date +%Y-%m-%d | tr -d '\n'"
 	wget_fmt_string:"wget -qO- " , d.url , " | grep -o \"<title>[^<]*\" | sed -e 's/<[^>]*>//g' | tr -d '\n'"
-	t:insert title:(shell[wget_fmt_string].out) reference:(d.url) created_date:(shell[date_fmt_string].out) into t
+	wget_res:shell[wget_fmt_string]
+	if wget_res.exit = -1 do
+		exit["\n    wget failed\n"] # this is weaksauce, but better than nothing, I suppose
+	else
+		t:insert title:(wget_res.out) reference:(d.url) created_date:(shell[date_fmt_string].out) into t
+	end
 end
 
 if args[2] do
diff --git a/src/test.csv b/src/test.csv
index c0b5fe6..8217333 100644
--- a/src/test.csv
+++ b/src/test.csv
@@ -2,4 +2,5 @@ title,reference,created_date
 small and nearly silent | pubnix programming playground for friends,https://smallandnearlysilent.com,2022-12-10
 Oatmeal,https://eli.li,2022-12-10
 Ten Forward,https://tenforward.social,2022-12-10
-"DuckDuckGo     Privacy, simplified.",https://duckduckgo.com,2022-12-10
\ No newline at end of file
+"DuckDuckGo     Privacy, simplified.",https://duckduckgo.com,2022-12-10
+Google,https://google.com,2022-12-11
\ No newline at end of file