Skip to content

Instantly share code, notes, and snippets.

@ajashton
Last active April 13, 2022 10:08
Show Gist options
  • Save ajashton/6504728 to your computer and use it in GitHub Desktop.
Save ajashton/6504728 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e -u
domain='http://geojson.io'
infile=''
if (uname | grep -q 'Darwin'); then
open='open'
else
open='xdg-open'
fi
for arg in "$@"; do
case $arg in
--help|-h) echo 'geojsonio! TODO: help text'; exit;;
--print) open='echo';;
--domain=*) domain=$(echo $arg | cut -c 10-);;
*) infile=$arg;;
esac
done
$open $domain/#data=data:application/json,\
$(cat $infile | perl -MURI::Escape -ne 'print uri_escape($_)')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment