Skip to content

Commit f62ff43

Browse files
committed
Add version output, fixes #30
1 parent 8649ac4 commit f62ff43

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Sources/CoreLocationCLI/main.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ class Delegate: NSObject, CLLocationManagerDelegate {
140140
func help() {
141141
print("""
142142
USAGE: CoreLocationCLI --help
143+
CoreLocationCLI --version
143144
CoreLocationCLI [--watch] [--verbose] [--format FORMAT]
144145
CoreLocationCLI [--watch] [--verbose] --json
145146
@@ -179,6 +180,11 @@ class Delegate: NSObject, CLLocationManagerDelegate {
179180
compatible with the JSON Lines text format.
180181
""")
181182
}
183+
184+
func version() {
185+
let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "Unknown"
186+
print("CoreLocationCLI version \(version)")
187+
}
182188
}
183189

184190
let delegate = Delegate()
@@ -187,6 +193,9 @@ for (i, argument) in ProcessInfo().arguments.enumerated() {
187193
case "-h", "--help":
188194
delegate.help()
189195
exit(0)
196+
case "--version":
197+
delegate.version()
198+
exit(0)
190199
case "-w", "--watch":
191200
delegate.follow = true
192201
case "-v", "--verbose":

0 commit comments

Comments
 (0)