Rename commands
This commit is contained in:
parent
88feaec305
commit
62edec831f
|
@ -2,18 +2,18 @@
|
|||
|
||||
[![Swift 5 compatible][swift-badge]][Swift] [![Xcode 10.2 compatible][xcode-badge]][Xcode]
|
||||
|
||||
This is a tool to manage Xcode simulators and their [root certificates][RootCertificate].
|
||||
This is a tool to manage [root certificates][RootCertificate] in Xcode simulators.
|
||||
|
||||
If you have a certificate for your server in PEM format in a file `myhost.crt`, type:
|
||||
|
||||
```bash
|
||||
$ xcode-simulator-cert install-ca myhost.crt
|
||||
$ xcode-simulator-cert install myhost.crt
|
||||
```
|
||||
|
||||
It will then install the certificate in all your simulators. You can also specify a specific simulator:
|
||||
|
||||
```bash
|
||||
$ xcode-simulator-cert install-ca myhost.crt --device-name="iPhone 8"
|
||||
$ xcode-simulator-cert install myhost.crt --device-name="iPhone 8"
|
||||
```
|
||||
|
||||
There are also some other subcommands and options available. `--help` is your friend.
|
||||
|
|
|
@ -33,10 +33,10 @@ struct CommandLineOptions {
|
|||
fileprivate(set) var verbosity: Verbosity
|
||||
|
||||
private static let allCommands: [Command] = [
|
||||
ListDevicesCommand(),
|
||||
InstallCACommand(),
|
||||
ExportCACommand(),
|
||||
RemoveCACommand()
|
||||
ListCommand(),
|
||||
InstallCommand(),
|
||||
ExportCommand(),
|
||||
RemoveCommand()
|
||||
]
|
||||
|
||||
static func parse(commandName: String, arguments: [String]) throws -> CommandLineOptions {
|
||||
|
|
|
@ -6,10 +6,10 @@ import Foundation
|
|||
import Basic
|
||||
import SPMUtility
|
||||
|
||||
class ExportCACommand: Command {
|
||||
class ExportCommand: Command {
|
||||
private struct Options {
|
||||
}
|
||||
let name = "export-ca"
|
||||
let name = "export"
|
||||
let overview = "Export Certificate Authorities"
|
||||
|
||||
private let binder = ArgumentBinder<Options>()
|
|
@ -5,12 +5,12 @@
|
|||
import Foundation
|
||||
import SPMUtility
|
||||
|
||||
class InstallCACommand: Command {
|
||||
class InstallCommand: Command {
|
||||
struct Options {
|
||||
var path: String?
|
||||
var dryRun: Bool = false
|
||||
}
|
||||
let name = "install-ca"
|
||||
let name = "install"
|
||||
let overview = "Install a Certificate Authority"
|
||||
|
||||
private let binder = ArgumentBinder<Options>()
|
||||
|
@ -45,7 +45,7 @@ class InstallCACommand: Command {
|
|||
}
|
||||
|
||||
func run(reporter: Reporter) throws {
|
||||
let runner = InstallCACommandRunner(
|
||||
let runner = InstallCommandRunner(
|
||||
options: options,
|
||||
filteringOptions: filteringOptions,
|
||||
reporter: reporter
|
|
@ -4,13 +4,13 @@
|
|||
|
||||
import Foundation
|
||||
|
||||
class InstallCACommandRunner {
|
||||
class InstallCommandRunner {
|
||||
private let reporter: Reporter
|
||||
private let options: InstallCACommand.Options
|
||||
private let options: InstallCommand.Options
|
||||
private let filteringOptions: FilteringOptions
|
||||
|
||||
init(
|
||||
options: InstallCACommand.Options,
|
||||
options: InstallCommand.Options,
|
||||
filteringOptions: FilteringOptions,
|
||||
reporter: Reporter) {
|
||||
self.reporter = reporter
|
|
@ -5,11 +5,11 @@
|
|||
import Foundation
|
||||
import SPMUtility
|
||||
|
||||
class ListDevicesCommand: Command {
|
||||
let name = "list-devices"
|
||||
let overview = "List available Xcode Simulator devices"
|
||||
class ListCommand: Command {
|
||||
let name = "list"
|
||||
let overview = "List available certificates in Xcode Simulators"
|
||||
|
||||
private let binder = ArgumentBinder<ListDevicesCommand>()
|
||||
private let binder = ArgumentBinder<ListCommand>()
|
||||
private var filteringOptions = FilteringOptions()
|
||||
private let filteringBinder = ArgumentBinder<FilteringOptions>()
|
||||
|
|
@ -5,11 +5,11 @@
|
|||
import Foundation
|
||||
import SPMUtility
|
||||
|
||||
class RemoveCACommand: Command {
|
||||
class RemoveCommand: Command {
|
||||
private struct Options {
|
||||
var dryRun: Bool = false
|
||||
}
|
||||
let name = "remove-ca"
|
||||
let name = "remove"
|
||||
let overview = "Remove all Certificate Authorities from specified devices"
|
||||
|
||||
private let binder = ArgumentBinder<Options>()
|
|
@ -3,7 +3,7 @@
|
|||
// Should not be under version control.
|
||||
//
|
||||
|
||||
public extension XcodeSimulatorTool {
|
||||
public extension XcodeSimulatorCert {
|
||||
static var version: String {
|
||||
return "0.1.0"
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import Foundation
|
|||
import Basic
|
||||
import SPMUtility
|
||||
|
||||
public class XcodeSimulatorTool {
|
||||
public class XcodeSimulatorCert {
|
||||
private let arguments: [String]
|
||||
|
||||
public init(arguments: [String]) {
|
||||
|
@ -39,7 +39,7 @@ public class XcodeSimulatorTool {
|
|||
case .noCommand:
|
||||
options.printUsage(on: stdoutStream)
|
||||
case .version:
|
||||
print("xcode-simulator-cert version \(XcodeSimulatorTool.version)")
|
||||
print("xcode-simulator-cert version \(XcodeSimulatorCert.version)")
|
||||
case .command(let command):
|
||||
try command.run(reporter: DefaultReporter(verbosity: options.verbosity))
|
||||
}
|
|
@ -5,4 +5,4 @@
|
|||
import Foundation
|
||||
import XcodeSimulatorKit
|
||||
|
||||
exit(XcodeSimulatorTool(arguments: CommandLine.arguments).run())
|
||||
exit(XcodeSimulatorCert(arguments: CommandLine.arguments).run())
|
||||
|
|
|
@ -39,8 +39,8 @@ fi
|
|||
|
||||
echo "${LOGO} Installing root certificate"
|
||||
pushd .. >& /dev/null
|
||||
echo swift run xcode-simulator-cert --verbosity=loud install-ca ${CERT_PATH} --uuid=${UUID}
|
||||
swift run xcode-simulator-cert --verbosity=loud install-ca ${CERT_PATH} --uuid=${UUID}
|
||||
echo swift run xcode-simulator-cert --verbosity=loud install ${CERT_PATH} --uuid=${UUID}
|
||||
swift run xcode-simulator-cert --verbosity=loud install ${CERT_PATH} --uuid=${UUID}
|
||||
popd >& /dev/null
|
||||
|
||||
# Booting
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
# This can be useful for testing the install-ca command
|
||||
# This can be useful for testing the install command
|
||||
|
||||
openssl req -x509 -newkey rsa:4096 -keyout test-ca.key -out test-ca.crt -days 365 -nodes -subj '/CN=localhost'
|
||||
|
|
Loading…
Reference in New Issue