Skip to content

Commit

Permalink
treehouses internet reverse always postal (fixes #2074) (#2078)
Browse files Browse the repository at this point in the history
Co-authored-by: dogi <[email protected]>
  • Loading branch information
rjpadilla and dogi committed Mar 11, 2021
1 parent a99246b commit 6153489
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion modules/internet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)"'
;;
*)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit 6153489

Please sign in to comment.