mirror of
https://github.com/yonaskolb/XcodeGen.git
synced 2024-09-20 09:08:46 +03:00
21 lines
578 B
Swift
21 lines
578 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.nextIsOption() {
|
|
arguments.manipulate { existing in
|
|
[defaultCommand.name] + existing
|
|
}
|
|
}
|
|
return try DefaultRouter().parse(commandGroup: commandGroup, arguments: arguments)
|
|
}
|
|
}
|