From 6153489085c53d0c5e32a18844921f6a16befdf5 Mon Sep 17 00:00:00 2001 From: RJ Padilla Date: Wed, 10 Mar 2021 23:28:32 -0500 Subject: [PATCH] `treehouses internet reverse` always postal (fixes #2074) (#2078) Co-authored-by: dogi --- modules/internet.sh | 6 +++++- package.json | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/internet.sh b/modules/internet.sh index 137e95f9c5..d8295d5e60 100644 --- a/modules/internet.sh +++ b/modules/internet.sh @@ -15,7 +15,11 @@ function internet { fi info="$(curl -s ipinfo.io | grep -o '"[^"]*"\s*:\s*"[^"]*"')" echo "$info" | grep -E '"(ip)"' - echo "$info" | grep -E '"(city|country|postal)"' | tr '\n' ',' | sed 's/,$/\n/' | sed 's/\",\"/\", \"/g' + if ! echo "$info" | grep -E 'postal'; then + echo "$info" | grep -E '"(city|country)"' | tr '\n' ',' | sed 's/,$/, "postal": "n\/a"\n/' | sed 's/\",\"/\", \"/g' + else + echo "$info" | grep -E '"(city|country|postal)"' | tr '\n' ',' | sed 's/,$/\n/' | sed 's/\",\"/\", \"/g' + fi echo "$info" | grep -E '"(org|timezone)"' ;; *) diff --git a/package.json b/package.json index 86372d8d4f..fa10827c64 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@treehouses/cli", - "version": "1.25.18", + "version": "1.25.19", "remote": "4000", "description": "Thin command-line interface for Raspberry Pi low level configuration.", "main": "cli.sh",