Skip to content

Commit fed2d54

Browse files
committed
Use variadic parameters
1 parent 7585871 commit fed2d54

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Sources/Commandant/Command.swift

+7-5
Original file line numberDiff line numberDiff line change
@@ -86,16 +86,18 @@ public final class CommandRegistry<ClientError: Error> {
8686

8787
public init() {}
8888

89-
/// Registers the given command, making it available to run.
89+
/// Registers the given commands, making those available to run.
9090
///
91-
/// If another command was already registered with the same `verb`, it will
92-
/// be overwritten.
91+
/// If another commands were already registered with the same `verb`s, those
92+
/// will be overwritten.
9393
@discardableResult
94-
public func register<C: CommandProtocol>(_ command: C)
94+
public func register<C: CommandProtocol>(_ commands: C...)
9595
-> CommandRegistry
9696
where C.ClientError == ClientError, C.Options.ClientError == ClientError
9797
{
98-
commandsByVerb[command.verb] = CommandWrapper(command)
98+
for command in commands {
99+
commandsByVerb[command.verb] = CommandWrapper(command)
100+
}
99101
return self
100102
}
101103

0 commit comments

Comments
 (0)