We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9be0581 commit 1fde582Copy full SHA for 1fde582
Commander/Group.swift
@@ -49,6 +49,9 @@ public class Group : CommandType {
49
50
var commands = [SubCommand]()
51
52
+ // When set, allows you to override the default unknown command behaviour
53
+ public var unknownCommand: ((name: String, parser: ArgumentParser) throws -> ())?
54
+
55
/// Create a new group
56
public init() {}
57
@@ -80,6 +83,8 @@ public class Group : CommandType {
80
83
} catch let error as Help {
81
84
throw error.reraise(name)
82
85
}
86
+ } else if let unknownCommand = unknownCommand {
87
+ try unknownCommand(name: name, parser: parser)
88
} else {
89
throw GroupError.UnknownCommand(name)
90
0 commit comments