34 lines
863 B
Swift
34 lines
863 B
Swift
//
|
|
// 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>()
|
|
private var path: String?
|
|
|
|
func addOptions(to parser: ArgumentParser) {
|
|
binder.bind(positional: parser.add(
|
|
positional: "path",
|
|
kind: String.self
|
|
), to: { command, path in
|
|
command.path = path
|
|
})
|
|
}
|
|
|
|
mutating func fillParseResult(_ parseResult: ArgumentParser.Result) throws {
|
|
try binder.fill(parseResult: parseResult, into: &self)
|
|
}
|
|
|
|
func run() throws {
|
|
let url = URL(fileURLWithPath: path!)
|
|
let certificate = try Certificate.load(from: url)
|
|
print(certificate)
|
|
}
|
|
}
|