From 3537be9e7c578f8ca84e9d420044654577706a11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Sun, 22 Nov 2020 18:54:41 +0100 Subject: Add more useful headers --- blm | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'blm') diff --git a/blm b/blm index f00e254..51bd0e5 100755 --- a/blm +++ b/blm @@ -4,9 +4,21 @@ jq -r '.data[] | "From BLOCKET " + (.list_time | sub("\\+[0-9][0-9]:00$"; "Z") | fromdate | strftime("%a %b %e %T %Y")) + "\n" + - "From: \"" + .advertiser.name + ", " + .location[0].name + " (" + .advertiser.type + ")\" \n" + - "Subject: " + "(" + (.price.value | tostring) + ") " + .subject + "\n" + - ([.images[].url] | map("X-Image: " + . + "?type=original") | join("\n")) + "\n" + +'"$(test "$1" = -d && printf '%s\n' ' + "From: \"" + .advertiser.name + ", " + .location[0].name + "\" \n" + + "Subject: (" + (.price.value | tostring) + ") " + .subject + "\n" + +' || printf '%s\n' ' + "From: \"" + .advertiser.name + "\" \n" + + "Subject: " + .subject + "\n" + +')"' + "ID: " + .ad_id + "\n" + + "Link: " + .share_url + "\n" + + "Price: " + (.price.value | tostring) + " " + .price.suffix + "\n" + + "Type: " + .advertiser.type + "\n" + + ([.category[].name] | map("Category: " + . ) | join("\n")) + "\n" + + ([.location[].name] | map("Location: " + . ) | join("\n")) + "\n" + + "Map: " + .map_url + "\n" + + ([.images[].url] | map("Image: " + . + "?type=original") | join("\n")) + "\n" + "\n" + .body + "\n" + "\n" ' -- cgit v1.2.3