Skip to content

Commit

Permalink
Use variadic parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
ikesyo committed Aug 14, 2017
1 parent 7585871 commit fed2d54
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Sources/Commandant/Command.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,18 @@ public final class CommandRegistry<ClientError: Error> {

public init() {}

/// Registers the given command, making it available to run.
/// Registers the given commands, making those available to run.
///
/// If another command was already registered with the same `verb`, it will
/// be overwritten.
/// If another commands were already registered with the same `verb`s, those
/// will be overwritten.
@discardableResult
public func register<C: CommandProtocol>(_ command: C)
public func register<C: CommandProtocol>(_ commands: C...)
-> CommandRegistry
where C.ClientError == ClientError, C.Options.ClientError == ClientError
{
commandsByVerb[command.verb] = CommandWrapper(command)
for command in commands {
commandsByVerb[command.verb] = CommandWrapper(command)
}
return self
}

Expand Down

0 comments on commit fed2d54

Please # to comment.