|
1 | | -# Usage |
| 1 | +# CoreLocationCLI |
2 | 2 |
|
3 | | -`./CoreLocationCLI [-once]` |
| 3 | +CoreLocationCLI gets the physical location of your device and prints it to standard output. If you move it will also print out your updated location. *Kill it with CTRL-C.* |
4 | 4 |
|
5 | | -If running from a Mac, make sure your WiFi is turned on. Otherwise you will see `kCLErrorDomain error 0`. |
| 5 | + |
6 | 6 |
|
7 | | -# Overview |
| 7 | +Note for Mac users: make sure WiFi is turned on. Otherwise you will see `kCLErrorDomain error 0`. |
8 | 8 |
|
9 | | -Prints location information from CoreLocation. If the `-once YES` option |
10 | | -is used, will exit after first location update. Otherwise, will |
11 | | -continuously print output. After you download, be sure to chmod 755 |
12 | | -and run from Terminal. |
| 9 | +# Usage |
13 | 10 |
|
14 | | -``` |
15 | | -USAGE: CoreLocationCLI [options] |
16 | | - Displays current location using CoreLocation services. |
17 | | - By default, this will continue printing locations until you kill it with Ctrl-C. |
18 | | -
|
19 | | -OPTIONS: |
20 | | - -h Display this help message and exit |
21 | | -
|
22 | | - -once YES Print one location and exit |
23 | | - -verbose YES Verbose mode |
24 | | - -format 'format' Print a formatted string with the following specifiers |
25 | | - %%latitude Latitude (degrees north; or negative for south |
26 | | - %%longitude Longitude (degrees west; or negative for east |
27 | | - %%altitude Altitude (meters) |
28 | | - %%direction Degrees from true north |
29 | | - %%speed Meters per second |
30 | | - %%h_accuracy Horizontal accuracy (meters) |
31 | | - %%v_accuracy Vertical accuracy (meters) |
32 | | - %%time Time |
33 | | - %%address Reverse geocoded location to an address |
34 | | - -json Use the format {\"latitude\":%latitude, \"longitude\":%longitude} |
35 | | - Also implies -once |
36 | | -
|
37 | | - Default format if unspecified is: %%latitude %%longitude |
| 11 | +```sh |
| 12 | +CoreLocationCLI -h |
| 13 | +CoreLocationCLI [-once] -json |
| 14 | +CoreLocationCLI [-once] [-verbose] [-format FORMAT] |
38 | 15 | ``` |
39 | 16 |
|
40 | | -# Output example |
41 | | - |
| 17 | +| Switch | Description | |
| 18 | +| ---------------- | ------------------------------------------------------ | |
| 19 | +| `-h` | Display this help message and exit | |
| 20 | +| `-once` | Print one location and exit | |
| 21 | +| `-verbose` | Verbose mode | |
| 22 | +| `-json` | JSON output mode | |
| 23 | +| `-format FORMAT` | Print a formatted string with the following specifiers | |
| 24 | + |
| 25 | +| Format | Description | |
| 26 | +| -------------- | ---------------------------------------------- | |
| 27 | +| `%%latitude` | Latitude (degrees north; or negative for south | |
| 28 | +| `%%longitude` | Longitude (degrees west; or negative for east | |
| 29 | +| `%%altitude` | Altitude (meters) | |
| 30 | +| `%%direction` | Degrees from true north | |
| 31 | +| `%%speed` | Meters per second | |
| 32 | +| `%%h_accuracy` | Horizontal accuracy (meters) | |
| 33 | +| `%%v_accuracy` | Vertical accuracy (meters) | |
| 34 | +| `%%time` | Time | |
| 35 | +| `%%address` | Reverse geocoded location to an address | |
| 36 | + |
| 37 | +The default format if unspecified is: `%%latitude %%longitude`. |
| 38 | + |
| 39 | +# Output examples |
| 40 | + |
| 41 | +```sh |
42 | 42 | ./CoreLocationCLI |
| 43 | +``` |
43 | 44 |
|
44 | | - 50.943829 6.941043 |
| 45 | +> 50.943829 6.941043 |
45 | 46 |
|
| 47 | +```sh |
46 | 48 | ./CoreLocationCLI -once yes -format "%latitude %longitude\n%address" |
| 49 | +``` |
47 | 50 |
|
48 | 51 | 50.943829 6.941043 |
49 | 52 | Kaiser-Wilhelm-Ring 21 |
50 | 53 | Cologne North Rhine-Westphalia 50672 |
51 | 54 | Germany |
52 | 55 |
|
| 56 | +```sh |
53 | 57 | ./CoreLocationCLI -json |
| 58 | +``` |
54 | 59 |
|
55 | | - {"latitude":40.124159, "longitude":-75.036274} |
| 60 | +```json |
| 61 | +{"latitude":40.124159, "longitude":-75.036274} |
| 62 | +``` |
56 | 63 |
|
57 | | -# Building |
| 64 | +# Installation |
58 | 65 |
|
59 | | -To build this from the command line, run the compiler: |
| 66 | +Install the latest release using Homebrew with: |
60 | 67 |
|
61 | | - xcodebuild |
| 68 | +```sh |
| 69 | +brew cask install corelocationcli |
| 70 | +``` |
62 | 71 |
|
63 | | -And then your executable can be run from this location: |
| 72 | +Or build from the command line using the Xcode compiler: |
64 | 73 |
|
65 | | - build/Release/CoreLocationCLI |
| 74 | +```sh |
| 75 | +xcodebuild |
| 76 | +``` |
66 | 77 |
|
67 | | -# Contact |
| 78 | +Then run your executable from this location: |
68 | 79 |
|
69 | | - |
| 80 | +```sh |
| 81 | +build/Release/CoreLocationCLI |
| 82 | +``` |
0 commit comments