Skip to content

Commit e070247

Browse files
authored
Merge pull request #136 from Pyroh/master
Add the possibility to set help command’s function during init
2 parents d69a33a + 19fca32 commit e070247

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Sources/Commandant/HelpCommand.swift

+4-3
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,15 @@ public struct HelpCommand<ClientError: Error>: CommandProtocol {
2222
public typealias Options = HelpOptions<ClientError>
2323

2424
public let verb = "help"
25-
public let function = "Display general or command-specific help"
26-
25+
public let function: String
26+
2727
private let registry: CommandRegistry<ClientError>
2828

2929
/// Initializes the command to provide help from the given registry of
3030
/// commands.
31-
public init(registry: CommandRegistry<ClientError>) {
31+
public init(registry: CommandRegistry<ClientError>, function: String? = nil) {
3232
self.registry = registry
33+
self.function = function ?? "Display general or command-specific help"
3334
}
3435

3536
public func run(_ options: Options) -> Result<(), ClientError> {

0 commit comments

Comments
 (0)