WhereAmI
WhereAmI copied to clipboard
Not an issue as well, I've made a Brew cask
If anyone interested, you can install robmathers/WhereAmI
via Homebrew cask by tapping welldan97/whereami:
$ brew tap welldan97/whereami
==> Tapping welldan97/whereami
Cloning into '/opt/boxen/homebrew/Library/Taps/welldan97/homebrew-whereami'...
remote: Counting objects: 5, done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 5 (delta 0), reused 5 (delta 0), pack-reused 0
Unpacking objects: 100% (5/5), done.
Checking connectivity... done.
Tapped 0 formulae (28 files, 17.2K)
$ brew cask install whereami
==> Downloading https://github.com/robmathers/WhereAmI/releases/download/v1.02/whereami-1.02.zip
######################################################################## 100.0%
==> Verifying checksum for Cask whereami
==> Symlinking Binary 'whereami' to '/usr/local/bin/whereami'
🍺 whereami staged at '/opt/homebrew-cask/Caskroom/whereami/latest' (36K)
$ whereami
Latitude: 56.320993
Longitude: 44.027497
Accuracy (m): 65.000000
Timestamp: 01/03/2016, 12:11:27 GMT+3
Also I've made a small script:
#!/usr/bin/env bash
set -e
main() {
output=''
while ! does-include "$output" 'Latitude' ; do
output=$(whereami)
done
echo $(fetch "$output" 'Latitude') $(fetch "$output" 'Longitude')
}
fetch() {
echo "$1" | grep "$2" | head -n 1 | cut -d' ' -f2
}
does-include() {
echo "$1" | grep "$2" > /dev/null
}
main "$@"
It makes output more consistent - remove duplicates, keeps retrying till return results, and returns just latitude and longitude, i.e.:
$ w97-whereami
56.320956 44.027472
$ brew cask install whereami ==> Downloading https://github.com/robmathers/WhereAmI/releases/download/v1.02/whereami-1.02.zip ######################################################################## 100.0% ==> Verifying checksum for Cask whereami ==> Symlinking Binary 'whereami' to '/usr/local/bin/whereami' 🍺 whereami staged at '/opt/homebrew-cask/Caskroom/whereami/latest' (36K)
Now brew cask install
is deprecated; just use brew install
is okay. And tested on Apple Silicon with macOS 11.3, it works fine.
BTW, @welldan97 it warns me Warning: Unexpected method 'license' called on Cask whereami.
when I tapped your formula; probably you can fix that.