Placeholder install-command

This commit is contained in:
Simon Kågedal Reimer 2019-05-26 12:09:53 +02:00
parent 7f4575fdba
commit a92d9bd550
3 changed files with 39 additions and 1 deletions

View File

@ -1,3 +1,11 @@
# xcode-simulator-tool
A description of this package.
## TODO
* PEM parser
* `install-ca` command
* Filter for os types
* Find out why the argument parsin errors are not printed correctly

View File

@ -43,7 +43,7 @@ struct CommandLineOptions {
private let parser: ArgumentParser
private(set) var subCommand: SubCommand
private static let allCommands: [Command] = [ListDevicesCommand()]
private static let allCommands: [Command] = [ListDevicesCommand(), InstallCACommand()]
static func parse(commandName: String, arguments: [String]) throws -> CommandLineOptions {
let parser = ArgumentParser(

View File

@ -0,0 +1,30 @@
//
// Copyright © 2019 Simon Kågedal Reimer. See LICENSE.
//
import Foundation
import SPMUtility
struct InstallCACommand: Command {
let name = "install-ca"
let overview = "Install a Certificate Authority"
private let binder = ArgumentBinder<InstallCACommand>()
func addOptions(to parser: ArgumentParser) {
binder.bind(positional: parser.add(
positional: "path",
kind: String.self
), to: { command, path in
print("Chosen path: \(path)")
})
}
mutating func fillParseResult(_ parseResult: ArgumentParser.Result) throws {
try binder.fill(parseResult: parseResult, into: &self)
}
func run() throws {
print("Running!")
}
}