Files
XcodeGen/Sources/XcodeGenCLI/CommandRouter.swift
T
2018-11-11 00:42:21 +11:00

21 lines
532 B
Swift

import Foundation
import SwiftCLI
class CommandRouter: Router {
let defaultCommand: Command
init(defaultCommand: Command) {
self.defaultCommand = defaultCommand
}
func parse(commandGroup: CommandGroup, arguments: ArgumentList) throws -> (CommandPath, OptionRegistry) {
if !arguments.hasNext() {
arguments.manipulate { _ in
[defaultCommand.name]
}
}
return try DefaultRouter().parse(commandGroup: commandGroup, arguments: arguments)
}
}