- Notifications
You must be signed in to change notification settings - Fork4
Commute times on the command line!
License
KyleBanks/commuter
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Get commute times on the command line!
- Get commuting time between locations.
- Name and add your frequent locations for easier access.
- Geolocation allows you to use your current location without typing an address.
Download the appropriatecommuter
binary from theReleases page.
Alternatively, if you have a working Go installation, you can installcommuter
like so:
$ go get github.com/KyleBanks/commuter
The first time you runcommuter
, you'll be prompted to provide aGoogle Maps API Key and default location.
Important: Ensure you enable theGoogle Maps Distance Matrix API atdevelopers.google.com/console. If you want to use the-from-current
and-to-current
flags, you will also need to enable theGoogle Maps Geolocation API.
$ commuter> Enter Google Maps API Key: (developers.google.com/console)123APIKEY456> Enter Your Default Location: (ex. 123 Main St. Toronto, Canada)123 Main St. Toronto, Ontario
The API key and default location will be stored locally, and are never sent to any remote services aside from the official Google Maps API. The default location is then used by default when a-from
or-to
location is not provided.
Next, request your commute time:
# From your default to a specific location:$ commuter -to"321 Maple Ave. Toronto, Ontario"32 Minutes# From a specific location to your default:$ commuter -from"Toronto, Ontario"20 Minutes
If you want a commute time beginning and ending somewhere other than your default location, you can use supply full locations for both the-from
and-to
flags:
$ commuter -from"123 Main St. Toronto, Ontario" -to"321 Maple Ave. Toronto, Ontario"32 Minutes
You can also add names for your frequent locations like so:
$ commuter add -name home -location"123 Main St. Toronto, Ontario"$ commuter add -name work -address"321 Maple Ave. Toronto, Ontario"
And use them as thefrom
and/orto
location:
$ commuter -from home -to work32 Minutes
To see a list of all your named locations:
$ commuter listdefault: 123 Main St. Toronto, Ontario gym: 1024 Fitness Lane Toronto, Ontario work: 321 Maple Ave. Toronto, Ontario
If youenabled theGoogle Maps Geolocation API for your API key, you can use the-from-current
and-to-current
flags to use your current location. This is done by attempting to use your IP Address to determine your latitude and longitude, and use that as either the start or destination of your commute:
$ commuter -from-current -to work32 Minutes$ commuter -from gym -to-current12 Minutes
By default,commuter
assumes you are driving between locations. However, you can specify one or more commute methods using the-drive
,-walk
,-bike
and-transit
flags, like so:
# Single mode:$ commuter -walk -to work7 Hours 50 Minutes# Multiple modes:$ commuter -walk -transit -drive -bike -to workDrive: 30 MinutesWalk: 7 Hours 50 MinutesBike: 2 Hours 45 MinutesTransit: 1 Hour 17 Minutes
And of course the different travel modes can be combined with your current location:
$ commuter -bike -from-current -to gym2 Hours 18 Minutes
MIT LicenseCopyright (c) 2017 Kyle BanksPermission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in allcopies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THESOFTWARE.
About
Commute times on the command line!