diff --git a/Package.resolved b/Package.resolved index 8b874f0..2bcd947 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,22 +1,13 @@ { "object": { "pins": [ - { - "package": "Guaka", - "repositoryURL": "https://github.com/nsomar/Guaka.git", - "state": { - "branch": null, - "revision": "9dfb2ea95b8ab9e799d0f65a79a2316679a758e0", - "version": "0.1.3" - } - }, { "package": "PathKit", "repositoryURL": "https://github.com/kylef/PathKit.git", "state": { "branch": null, - "revision": "891a3fec2699fc43aed18b7649950677c0152a22", - "version": "0.8.0" + "revision": "404d60fd725d1ba7dbf55cb95a3046285a066169", + "version": "0.9.0" } }, { @@ -33,17 +24,8 @@ "repositoryURL": "https://github.com/kylef/Spectre.git", "state": { "branch": null, - "revision": "e46b75cf03ad5e563b4b0a5068d3d6f04d77d80b", - "version": "0.7.2" - } - }, - { - "package": "StringScanner", - "repositoryURL": "https://github.com/oarrabi/StringScanner", - "state": { - "branch": null, - "revision": "246c697efe2f57d9042f58b1b53ace4fddb1efc4", - "version": "0.2.0" + "revision": "e34d5687e1e9d865e3527dd58bc2f7464ef6d936", + "version": "0.8.0" } }, { diff --git a/Package.swift b/Package.swift index 8744ba5..89fc90b 100644 --- a/Package.swift +++ b/Package.swift @@ -19,7 +19,6 @@ let package = Package( .package(url: "https://github.com/kylef/PathKit.git", from: "0.8.0"), .package(url: "https://github.com/kareman/SwiftShell.git", from: "4.0.0"), .package(url: "https://github.com/onevcat/Rainbow.git", from: "2.1.0"), - .package(url: "https://github.com/nsomar/Guaka.git", from: "0.1.3"), .package(url: "https://github.com/apple/swift-package-manager.git", from: "0.1.0"), ], targets: [ @@ -30,7 +29,6 @@ let package = Package( dependencies: [ "MintKit", "Rainbow", - "Guaka", "SwiftShell", ]), .target( diff --git a/README.md b/README.md index 2dbab91..d1cb737 100644 --- a/README.md +++ b/README.md @@ -93,13 +93,13 @@ Run `mint --help` to see usage instructions. Run, install and update commands have 1 or 2 arguments: -- **repo (required)**: This can be a shorthand for a github repo `install realm/SwiftLint` or a fully qualified git path `install https://github.com/realm/SwiftLint.git`. In the case of `run` you can also just pass the name of the repo if it is already installed `run swiftlint`. This will do a lookup of all installed packages. An optional version can be specified by appending `@version`, otherwise the newest tag or master will be used. Note that if you don't specify a version, the current tags must be loaded remotely each time. -- **command (optional)**: The command to install or run. This defaults to the the last path in the repo (so for `realm/swiftlint` it will be `swiftlint`). In the case of `run` you can also pass any arguments to the command but make sure the whole thing is surrounded by quotes eg `mint run realm/swiftlint "swiftlint --path source"` +- **package (required)**: This can be a shorthand for a github repo `install realm/SwiftLint` or a fully qualified git path `install https://github.com/realm/SwiftLint.git`. In the case of `run` you can also just pass the name of the repo if it is already installed `run swiftlint`. This will do a lookup of all installed packages. An optional version can be specified by appending `@version`, otherwise the newest tag or master will be used. Note that if you don't specify a version, the current tags must be loaded remotely each time. +- **command (optional)**: The command to install or run. This defaults to the the last path in the repo (so for `realm/swiftlint` it will be `swiftlint`). In the case of `run` you can also pass any arguments to the command eg `mint run realm/swiftlint swiftlint --path source` #### Examples ```sh -$ mint install yonaskolb/XcodeGen@1.2.4 "XcodeGen --spec spec.yml" # pass some arguments +$ mint run yonaskolb/XcodeGen@1.2.4 xcodegen --spec spec.yml # pass some arguments $ mint install yonaskolb/XcodeGen@1.2.4 # use version 1.2.4 $ mint install yonaskolb/XcodeGen # use newest tag $ mint run yonaskolb/XcodeGen@1.2.4 # run 1.2.4 diff --git a/Sources/Mint/main.swift b/Sources/Mint/main.swift index da6a58e..765b5ac 100644 --- a/Sources/Mint/main.swift +++ b/Sources/Mint/main.swift @@ -1,143 +1,22 @@ +import Foundation import MintKit import Rainbow -import Foundation import SwiftShell -import Guaka - -let mint = Mint(path: "/usr/local/lib/mint") - -func catchError(closure: () throws -> Void) { - do { - try closure() - } catch { - if let error = error as? CommandError { - print("🌱 \(error.description)".red) - } else if let error = error as? SwiftShell.CommandError { - switch error { - case .inAccessibleExecutable(let path): main.stderror.print("Couldn't run command \(path)") - case .returnedErrorCode(let command, _): main.stderror.print("\(command.quoted) failed") - } - } else if let error = error as? MintError { - print("🌱 \(error.description)".red) - } else { - print("🌱 \(error.localizedDescription)".red) - } - exit(1) - } -} - -enum CommandError: Error, CustomStringConvertible { - case repoRequired - case invalidRepo(String) - case tooManyArguments - var description: String { - switch self { - case .repoRequired: - return "Repo required" - case let .invalidRepo(repo): - return "The repo was invalid: \(repo)" - case .tooManyArguments: - return "Too many arguments. Make sure command is surrounded in quotes" +do { + let mint = Mint(path: "/usr/local/lib/mint") + let mintInterface = MintInterace(mint: mint) + try mintInterface.execute(arguments: Array(ProcessInfo.processInfo.arguments.dropFirst())) +} catch { + if let error = error as? SwiftShell.CommandError { + switch error { + case let .inAccessibleExecutable(path): main.stderror.print("Couldn't run command \(path)") + case let .returnedErrorCode(command, _): main.stderror.print("\(command.quoted) failed") } + } else if error._domain == NSCocoaErrorDomain { + print("🌱 \(error.localizedDescription)".red) + } else { + print("🌱 \(error)".red) } + exit(1) } - -func getOptions(flags: Flags, args: [String]) throws -> (repo: String, version: String, command: String, verbose: Bool, global: Bool) { - guard let repoVersion = args.first else { throw CommandError.repoRequired } - let version: String - let command: String - let repoVersionParts = repoVersion.components(separatedBy: "@") - let repo: String - - switch repoVersionParts.count { - case 2: - repo = repoVersionParts[0] - version = repoVersionParts[1] - case 1: - repo = repoVersion - version = "" - default: - throw CommandError.invalidRepo(repoVersion) - } - - switch args.count { - case 2: - command = args[1] - case 1: - command = repo.components(separatedBy: "/").last!.components(separatedBy: ".").first! - default: - throw CommandError.tooManyArguments - } - return (repo: repo, - version: version, - command: command, - verbose: flags.getBool(name: "verbose") ?? false, - global: flags.getBool(name: "global") ?? false) -} - -let versionFlag = Flag(longName: "version", value: false, description: "Prints the version") -let verboseFlag = Flag(longName: "verbose", value: false, description: "Show installation output") -let globalFlag = Flag(longName: "global", value: false, description: "Install executable globally so it's accessible without \"mint run\". This will overwrite any other globally installed versions. An extra $PATH entry will also be added") - -let command = Command(usage: "mint", flags: [versionFlag]) -command.run = { flags, _ in - if let hasVersion = flags.getBool(name: "version"), hasVersion { - print(Mint.version) - return - } - print(command.helpMessage) -} - -let commandHelp = """ -This command takes allows you to specify a repo, a version and an executable command to run. - -- Repo is either in shorthand for a github repo \"githubName/repo\", or a fully qualified .git path. -- An optional version can be specified by appending @version to the repo, otherwise the newest tag or master will be used. -- The second argument qualifies the command name, otherwise this will be assumed to the be the end of the repo name. -""" - -let runCommand = Command(usage: "run package(@version) (command)", shortMessage: "Run a package", longMessage: "This will run a package. If it isn't installed if will do so first.\n\(commandHelp) The command can include any arguments and flags but the whole command must then be surrounded in quotes.", flags: [verboseFlag], example: "mint run realm/SwiftLint@0.22.0") { flags, args in - catchError { - let options = try getOptions(flags: flags, args: args) - try mint.run(repo: options.repo, version: options.version, command: options.command, verbose: options.verbose) - } -} - -let installCommand = Command(usage: "install package(@version) (command)", shortMessage: "Install a package", longMessage: "This will install a package. If it's already installed no action will be taken.\n\(commandHelp)", flags: [verboseFlag, globalFlag], example: "mint install realm/SwiftLint@0.22.0") { flags, args in - catchError { - let options = try getOptions(flags: flags, args: args) - try mint.install(repo: options.repo, version: options.version, command: options.command, force: false, verbose: options.verbose, global: options.global) - } -} - -let updateCommand = Command(usage: "update package(@version) (command)", shortMessage: "Update a package", longMessage: "This will update a package even if it's already installed.\n\(commandHelp)", flags: [verboseFlag, globalFlag], example: "mint install realm/SwiftLint@0.22.0") { flags, args in - catchError { - let options = try getOptions(flags: flags, args: args) - try mint.install(repo: options.repo, version: options.version, command: options.command, force: true, verbose: options.verbose, global: options.global) - } -} - -let uninstallCommand = Command(usage: "uninstall (package)", shortMessage: "Uninstall a package", longMessage: "This will uninstall a package by name. See all installed packages with \"mint list\")", example: "mint uninstall SwiftLint") { flags, args in - catchError { - let options = try getOptions(flags: flags, args: args) - try mint.uninstall(name: options.repo) - } -} - -let listCommand = Command(usage: "list", shortMessage: "List packages", longMessage: "This lists all the currently installed packages", example: "mint list") { _, _ in - catchError { - try mint.listPackages() - } -} - -let bootstrapCommand = Command(usage: "bootstrap") { _, _ in -} - -command.add(subCommand: runCommand) -command.add(subCommand: installCommand) -command.add(subCommand: updateCommand) -command.add(subCommand: uninstallCommand) -command.add(subCommand: listCommand) - -command.execute() diff --git a/Sources/MintKit/Commands/InstallCommand.swift b/Sources/MintKit/Commands/InstallCommand.swift new file mode 100644 index 0000000..031c470 --- /dev/null +++ b/Sources/MintKit/Commands/InstallCommand.swift @@ -0,0 +1,13 @@ +import Foundation +import Utility + +class InstallCommand: _InstallCommand { + + init(mint: Mint, parser: ArgumentParser) { + super.init(mint: mint, parser: parser, name: "install", description: "Installs a package. If the version is already installed no action will be taken") + } + + override func execute(parsedArguments: ArgumentParser.Result, repo: String, version: String, verbose: Bool, executable: String?, global: Bool) throws { + try mint.install(repo: repo, version: version, command: executable, force: false, verbose: verbose, global: global) + } +} diff --git a/Sources/MintKit/Commands/ListCommand.swift b/Sources/MintKit/Commands/ListCommand.swift new file mode 100644 index 0000000..cd7ce67 --- /dev/null +++ b/Sources/MintKit/Commands/ListCommand.swift @@ -0,0 +1,13 @@ +import Foundation +import Utility + +class ListCommand: MintCommand { + + init(mint: Mint, parser: ArgumentParser) { + super.init(mint: mint, parser: parser, name: "list", description: "Lists all the currently installed packages") + } + + override func execute(parsedArguments: ArgumentParser.Result) throws { + try mint.listPackages() + } +} diff --git a/Sources/MintKit/Commands/MintCommand.swift b/Sources/MintKit/Commands/MintCommand.swift new file mode 100644 index 0000000..bce242f --- /dev/null +++ b/Sources/MintKit/Commands/MintCommand.swift @@ -0,0 +1,16 @@ +import Foundation +import Utility + +class MintCommand { + + let mint: Mint + let subparser: ArgumentParser + + init(mint: Mint, parser: ArgumentParser, name: String, description: String) { + self.mint = mint + subparser = parser.add(subparser: name, overview: description) + } + + func execute(parsedArguments: ArgumentParser.Result) throws { + } +} diff --git a/Sources/MintKit/Commands/MintInterface.swift b/Sources/MintKit/Commands/MintInterface.swift new file mode 100644 index 0000000..af0f775 --- /dev/null +++ b/Sources/MintKit/Commands/MintInterface.swift @@ -0,0 +1,39 @@ +import Basic +import Foundation +import Utility + +public class MintInterace { + + let mint: Mint + + public init(mint: Mint) { + self.mint = mint + } + + public func execute(arguments: [String]) throws { + let parser = ArgumentParser(commandName: "mint", usage: "mint [subcommand]", overview: "run and install Swift PM executables") + let versionArgument = parser.add(option: "--version", shortName: "-v", kind: Bool.self, usage: "Prints the current version of Mint") + + let commands: [String: MintCommand] = [ + "run": RunCommand(mint: mint, parser: parser), + "install": InstallCommand(mint: mint, parser: parser), + "update": UpdateCommand(mint: mint, parser: parser), + "uninstall": UninstallCommand(mint: mint, parser: parser), + "list": ListCommand(mint: mint, parser: parser), + ] + + let parsedArguments = try parser.parse(arguments) + + if let printVersion = parsedArguments.get(versionArgument), printVersion == true { + print(Mint.version) + return + } + + if let subParser = parsedArguments.subparser(parser), + let command = commands[subParser] { + try command.execute(parsedArguments: parsedArguments) + } else { + parser.printUsage(on: stdoutStream) + } + } +} diff --git a/Sources/MintKit/Commands/PackageCommand.swift b/Sources/MintKit/Commands/PackageCommand.swift new file mode 100644 index 0000000..6de8732 --- /dev/null +++ b/Sources/MintKit/Commands/PackageCommand.swift @@ -0,0 +1,41 @@ +import Foundation +import Utility + +class PackageCommand: MintCommand { + + var verboseArgument: OptionArgument! + var packageArgument: PositionalArgument! + + override init(mint: Mint, parser: ArgumentParser, name: String, description: String) { + super.init(mint: mint, parser: parser, name: name, description: description) + + let packageHelp = """ + The identifier for the Swift Package to use. It can be a shorthand for a github repo \"githubName/repo\", or a fully qualified .git path. + An optional version can be specified by appending @version to the repo, otherwise the newest tag will be used (or master if no tags are found) + """ + packageArgument = subparser.add(positional: "package", kind: String.self, optional: false, usage: packageHelp) + verboseArgument = subparser.add(option: "--verbose", kind: Bool.self, usage: "Show installation output") + } + + override func execute(parsedArguments: ArgumentParser.Result) throws { + let verbose = parsedArguments.get(verboseArgument) ?? false + let package = parsedArguments.get(packageArgument)! + + let version: String + let packageParts = package.components(separatedBy: "@") + let repo: String + + if packageParts.count > 1 { + repo = packageParts[0] + version = packageParts[1] + } else { + repo = package + version = "" + } + + try execute(parsedArguments: parsedArguments, repo: repo, version: version, verbose: verbose) + } + + func execute(parsedArguments: ArgumentParser.Result, repo: String, version: String, verbose: Bool) throws { + } +} diff --git a/Sources/MintKit/Commands/RunCommand.swift b/Sources/MintKit/Commands/RunCommand.swift new file mode 100644 index 0000000..72924c1 --- /dev/null +++ b/Sources/MintKit/Commands/RunCommand.swift @@ -0,0 +1,17 @@ +import Foundation +import Utility + +class RunCommand: PackageCommand { + + var commandArgument: PositionalArgument<[String]>! + + init(mint: Mint, parser: ArgumentParser) { + super.init(mint: mint, parser: parser, name: "run", description: "Installs and then runs a package") + commandArgument = subparser.add(positional: "command", kind: [String].self, optional: true, strategy: .remaining, usage: "The command to run. This will default to the package name") + } + + override func execute(parsedArguments: ArgumentParser.Result, repo: String, version: String, verbose: Bool) throws { + let arguments = parsedArguments.get(commandArgument) + try mint.run(repo: repo, version: version, verbose: verbose, arguments: arguments) + } +} diff --git a/Sources/MintKit/Commands/UninstallCommand.swift b/Sources/MintKit/Commands/UninstallCommand.swift new file mode 100644 index 0000000..61bb862 --- /dev/null +++ b/Sources/MintKit/Commands/UninstallCommand.swift @@ -0,0 +1,17 @@ +import Foundation +import Utility + +class UninstallCommand: MintCommand { + + var packageArgument: PositionalArgument! + + init(mint: Mint, parser: ArgumentParser) { + super.init(mint: mint, parser: parser, name: "uninstall", description: "Uninstalls a package by name.\nUse mint list to see all installed packages") + packageArgument = subparser.add(positional: "name", kind: String.self, optional: false, usage: "The name of the package to uninstall") + } + + override func execute(parsedArguments: ArgumentParser.Result) throws { + let package = parsedArguments.get(packageArgument)! + try mint.uninstall(name: package) + } +} diff --git a/Sources/MintKit/Commands/UpdateCommand.swift b/Sources/MintKit/Commands/UpdateCommand.swift new file mode 100644 index 0000000..928140f --- /dev/null +++ b/Sources/MintKit/Commands/UpdateCommand.swift @@ -0,0 +1,36 @@ +import Foundation +import Utility + +class UpdateCommand: _InstallCommand { + + init(mint: Mint, parser: ArgumentParser) { + super.init(mint: mint, parser: parser, name: "update", description: "Updates a package even if it's already installed") + } + + override func execute(parsedArguments: ArgumentParser.Result, repo: String, version: String, verbose: Bool, executable: String?, global: Bool) throws { + + try mint.install(repo: repo, version: version, command: executable, force: true, verbose: verbose, global: global) + } +} + +class _InstallCommand: PackageCommand { + + var executableArgument: PositionalArgument! + var globalArgument: OptionArgument! + + override init(mint: Mint, parser: ArgumentParser, name: String, description: String) { + super.init(mint: mint, parser: parser, name: name, description: description) + executableArgument = subparser.add(positional: "executable", kind: String.self, optional: true, usage: "The executable to install") + globalArgument = subparser.add(option: "--global", shortName: "-g", kind: Bool.self, usage: "The executable to install") + } + + override func execute(parsedArguments: ArgumentParser.Result, repo: String, version: String, verbose: Bool) throws { + let executable = parsedArguments.get(executableArgument) + let global = parsedArguments.get(globalArgument) ?? false + + try execute(parsedArguments: parsedArguments, repo: repo, version: version, verbose: verbose, executable: executable, global: global) + } + + func execute(parsedArguments: ArgumentParser.Result, repo: String, version: String, verbose: Bool, executable: String?, global: Bool) throws { + } +} diff --git a/Sources/MintKit/Mint.swift b/Sources/MintKit/Mint.swift index 73c0463..c1d0720 100644 --- a/Sources/MintKit/Mint.swift +++ b/Sources/MintKit/Mint.swift @@ -1,7 +1,7 @@ -import SwiftShell -import PathKit import Foundation +import PathKit import Rainbow +import SwiftShell import Utility public struct Mint { @@ -18,7 +18,7 @@ public struct Mint { return path + "installs" } - var metadataPath: Path { + var metadataPath: Path { return path + "metadata.json" } @@ -78,10 +78,11 @@ public struct Mint { } @discardableResult - public func run(repo: String, version: String, command: String, verbose: Bool = false) throws -> Package { - let commandComponents = command.components(separatedBy: " ") - let name = commandComponents.first! - let arguments = commandComponents.count > 1 ? Array(commandComponents.suffix(from: 1)) : [] + public func run(repo: String, version: String, verbose: Bool = false, arguments: [String]? = nil) throws -> Package { + let guessedCommand = repo.components(separatedBy: "/").last!.components(separatedBy: ".").first! + let name = arguments?.first ?? guessedCommand + var arguments = arguments ?? [guessedCommand] + arguments = arguments.count > 1 ? Array(arguments.dropFirst()) : [] var git = repo if !git.contains("/") { // find repo @@ -109,8 +110,9 @@ public struct Mint { } @discardableResult - public func install(repo: String, version: String, command: String, force: Bool = false, verbose: Bool = false, global: Bool = false) throws -> Package { - let name = command.components(separatedBy: " ").first! + public func install(repo: String, version: String, command: String?, force: Bool = false, verbose: Bool = false, global: Bool = false) throws -> Package { + let guessedCommand = repo.components(separatedBy: "/").last!.components(separatedBy: ".").first! + let name = command ?? guessedCommand let package = Package(repo: repo, version: version, name: name) try install(package, force: force, verbose: verbose, global: global) return package @@ -205,7 +207,6 @@ public struct Mint { try installGlobal(packagePath: packagePath) } - try? packageCheckoutPath.delete() } @@ -235,7 +236,7 @@ public struct Mint { "~/.bash_profile", "~/.bashrc", "~/.zshenv", - ] + ] try files.forEach { let file = Path($0).absolute() @@ -266,7 +267,7 @@ public struct Mint { try? packagePath.delete() print("🌱 \(name) was uninstalled") default: - //TODO: ask for user input about which to delete + // TODO: ask for user input about which to delete for package in packages { let packagePath = packagesPath + package.value try? packagePath.delete() diff --git a/Sources/MintKit/MintError.swift b/Sources/MintKit/MintError.swift index a9a167e..bafa5a3 100644 --- a/Sources/MintKit/MintError.swift +++ b/Sources/MintKit/MintError.swift @@ -1,10 +1,3 @@ -// -// MintError.swift -// MintKit -// -// Created by Yonas Kolb on 19/12/17. -// - import Foundation public enum MintError: Error, CustomStringConvertible, Equatable { @@ -22,7 +15,7 @@ public enum MintError: Error, CustomStringConvertible, Equatable { } } - public static func ==(lhs: MintError, rhs: MintError) -> Bool { + public static func == (lhs: MintError, rhs: MintError) -> Bool { return lhs.description == rhs.description } } diff --git a/Sources/MintKit/PackagePath.swift b/Sources/MintKit/PackagePath.swift index 1b7413b..9565b3b 100644 --- a/Sources/MintKit/PackagePath.swift +++ b/Sources/MintKit/PackagePath.swift @@ -1,10 +1,3 @@ -// -// MintPath.swift -// MintKit -// -// Created by Yonas Kolb on 19/12/17. -// - import Foundation import PathKit @@ -31,7 +24,6 @@ struct PackagePath { var packagePath: Path { return path + repoPath } var installPath: Path { return packagePath + "build" + package.version } var commandPath: Path { return installPath + package.name } - static func gitURLFromString(_ string: String) -> String { if let url = URL(string: string), url.scheme != nil { diff --git a/Tests/LinuxMain.swift b/Tests/LinuxMain.swift index f2fb62b..85069c4 100644 --- a/Tests/LinuxMain.swift +++ b/Tests/LinuxMain.swift @@ -1,5 +1,5 @@ -import XCTest @testable import MintTests +import XCTest XCTMain([ testCase(MintTests.allTests), diff --git a/Tests/MintTests/MintTests.swift b/Tests/MintTests/MintTests.swift index 22fc491..663aeee 100644 --- a/Tests/MintTests/MintTests.swift +++ b/Tests/MintTests/MintTests.swift @@ -1,8 +1,7 @@ -import XCTest +@testable import MintKit import PathKit import SwiftShell - -@testable import MintKit +import XCTest class MintTests: XCTestCase { @@ -99,17 +98,20 @@ class MintTests: XCTestCase { func testRunCommand() throws { // run a specific version - let specificPackage = try mint.run(repo: testRepo, version: testVersion, command: testCommand) + let specificPackage = try mint.run(repo: testRepo, version: testVersion, arguments: [testCommand]) expectMintVersion(package: specificPackage) // run an already installed version - try mint.run(repo: testRepo, version: testVersion, command: testCommand) + try mint.run(repo: testRepo, version: testVersion, arguments: [testCommand]) // run without arguments - try mint.run(repo: testRepo, version: testVersion, command: testCommand) + try mint.run(repo: testRepo, version: testVersion, arguments: [testCommand]) + + // run with arguments + try mint.run(repo: testRepo, version: testVersion, arguments: [testCommand, "--version"]) // run latest version - let latestPackage = try mint.run(repo: testRepo, version: "", command: testCommand) + let latestPackage = try mint.run(repo: testRepo, version: "", arguments: [testCommand]) expectMintVersion(package: latestPackage) XCTAssertEqual(latestPackage.version, latestVersion) @@ -127,7 +129,7 @@ class MintTests: XCTestCase { func testMintErrors() { - func expectError(_ expectedError: MintError, closure: () throws -> ()) { + func expectError(_ expectedError: MintError, closure: () throws -> Void) { do { try closure() XCTFail("Expected to fail with \(expectedError)") @@ -139,7 +141,7 @@ class MintTests: XCTestCase { } expectError(MintError.repoNotFound("http://invaliddomain.com/invalid")) { - try mint.run(repo: "http://invaliddomain.com/invalid", version: testVersion, command: "invalid") + try mint.run(repo: "http://invaliddomain.com/invalid", version: testVersion, arguments: ["invalid"]) } expectError(MintError.invalidRepo("invalid repo")) { @@ -147,11 +149,11 @@ class MintTests: XCTestCase { } expectError(MintError.invalidCommand("invalidCommand")) { - try mint.run(repo: testRepo, version: testVersion, command: "invalidCommand") + try mint.run(repo: testRepo, version: testVersion, arguments: ["invalidCommand"]) } expectError(MintError.packageNotFound("invalidPackage")) { - try mint.run(repo: "invalidPackage", version: testVersion, command: "") + try mint.run(repo: "invalidPackage", version: testVersion, arguments: []) } }