Skip to content

Commit

Permalink
add option to use CommandRunner from Command.run
Browse files Browse the repository at this point in the history
  • Loading branch information
kattouf committed Sep 26, 2024
1 parent 1c2b097 commit 1643554
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Sources/Sake/Command+Map.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public extension Command {
}
}

private extension Command.Context {
public extension Command.Context {
func mapArguments(_ transform: ([String]) throws -> [String]) throws -> Command.Context {
try Command.Context(arguments: transform(arguments), environment: environment)
}
Expand Down
10 changes: 5 additions & 5 deletions Sources/Sake/CommandRunner.swift
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
final class CommandRunner {
public final class CommandRunner {
private let command: Command
private let context: Command.Context

init(command: Command, context: Command.Context) {
public init(command: Command, context: Command.Context) {
self.command = command
self.context = context
}

func run() throws {
public func run() throws {
if try command.skipIf(context) {
return
}
try command.dependencies.forEach {
let runner = CommandRunner(command: $0, context: context)
try command.dependencies.forEach { command in
let runner = CommandRunner(command: command, context: context)
try runner.run()
}
try command.run(context)
Expand Down

0 comments on commit 1643554

Please sign in to comment.