Skip to content

Commit

Permalink
Merge pull request #45 from elyscape/fix-json-output
Browse files Browse the repository at this point in the history
Fix JSON output
  • Loading branch information
fulldecent authored Aug 6, 2022
2 parents f380a7b + f816622 commit 264385f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Sources/CoreLocationCLI/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ class Delegate: NSObject, CLLocationManagerDelegate {

switch format {
case .json:
print(try! JSONEncoder().encode(formattedParts))
let output = try! JSONEncoder().encode(formattedParts)
print(String(data: output, encoding: .utf8)!)
case .string(let output):
print(formattedParts.reduce(output, { partialResult, keyValuePair in
partialResult.replacingOccurrences(of: "%\(keyValuePair.key)", with: keyValuePair.value ?? "")
Expand Down

2 comments on commit 264385f

@tcb678
Copy link

@tcb678 tcb678 commented on 264385f Aug 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fulldecent New binary release soon (for Homebrew users via Cask)?

@fulldecent
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.