Merge pull request #44 from ABridoux/hotfix/hotfix-1-0-1

CLT read command when other type than string
This commit is contained in:
Alexis Bridoux 2020-03-30 14:09:15 +02:00 committed by GitHub
commit 3a2acac968
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 4 deletions

View File

@ -3,6 +3,11 @@
All notable changes to this project will be documented in this file. `Scout` adheres to [Semantic Versioning](http://semver.org). All notable changes to this project will be documented in this file. `Scout` adheres to [Semantic Versioning](http://semver.org).
--- ---
## [1.0.1](https://github.com/ABridoux/scout/tree/1.0.1) (30/03/2020)
### Fixed
- CLT read command when other type than string was not working
## [1.0.0](https://github.com/ABridoux/scout/tree/1.0.0) (29/03/2020) ## [1.0.0](https://github.com/ABridoux/scout/tree/1.0.0) (29/03/2020)
### Added ### Added

View File

@ -1,3 +1,3 @@
public struct Version { public struct Version {
public static let current = "1.0.0" public static let current = "1.0.1"
} }

View File

@ -84,13 +84,13 @@ struct ReadCommand: ParsableCommand {
if let json = try? PathExplorerFactory.make(Json.self, from: data) { if let json = try? PathExplorerFactory.make(Json.self, from: data) {
let key = try json.get(readingPath) let key = try json.get(readingPath)
value = key.string ?? key.description value = key.stringValue != "" ? key.stringValue : key.description
} else if let plist = try? PathExplorerFactory.make(Plist.self, from: data) { } else if let plist = try? PathExplorerFactory.make(Plist.self, from: data) {
let key = try plist.get(readingPath) let key = try plist.get(readingPath)
value = key.string ?? key.description value = key.stringValue != "" ? key.stringValue : key.description
} else if let xml = try? PathExplorerFactory.make(Xml.self, from: data) { } else if let xml = try? PathExplorerFactory.make(Xml.self, from: data) {
let key = try xml.get(readingPath) let key = try xml.get(readingPath)
value = key.string ?? key.description value = key.stringValue != "" ? key.stringValue : key.description
} else { } else {
if let filePath = inputFilePath { if let filePath = inputFilePath {
throw RuntimeError.unknownFormat("The format of the file at \(filePath) is not recognized") throw RuntimeError.unknownFormat("The format of the file at \(filePath) is not recognized")