0001 // 0002 // ChainableCommand.swift 0003 // SwiftCLI 0004 // 0005 // Created by Jake Heiser on 7/25/14. 0006 // Copyright (c) 2014 jakeheis. All rights reserved. 0007 // 0008 0009 /// A chainable interface to a CommandType; all functions return the object itself for easy chaining. 0010 /// Should only be used for simple commands. 0011 public class ChainableCommand: LightweightCommand { 0012 0013 public override init
ChainableCommand.swift:17 public func withSignature(signature: String) -> ChainableCommand {ChainableCommand.swift:22 public func withShortDescription(shortDescription: String) -> ChainableCommand {ChainableCommand.swift:27 public func withShortcut(shortcut: String) -> ChainableCommand {ChainableCommand.swift:32 public func withOptionsSetup(optionsSetup: OptionsSetupBlock) -> ChainableCommand {ChainableCommand.swift:37 public func withUnrecognizedOptionsPrintingBehavior(behavior: UnrecognizedOptionsPrintingBehavior) -> ChainableCommand {ChainableCommand.swift:42 public func withFailOnUnrecognizedOptions(shouldFail: Bool) -> ChainableCommand {ChainableCommand.swift:47 public func withExecutionBlock(execution: ExecutionBlock) -> ChainableCommand {CLI.swift:74 public class func registerChainableCommand(commandName commandName: String) -> ChainableCommand {CLI.swift:75 let chainable = ChainableCommand(commandName: commandName)(commandName: String) { 0014 super.init(commandName: commandName) 0015 } 0016 0017 public func withSignature(signature: String) -> ChainableCommand { 0018 commandSignature = signature 0019 return self 0020 } 0021 0022 public func withShortDescription(shortDescription: String) -> ChainableCommand { 0023 commandShortDescription = shortDescription 0024 return self 0025 } 0026 0027 public func withShortcut(shortcut: String) -> ChainableCommand { 0028 commandShortcut = shortcut 0029 return self 0030 } 0031 0032 public func withOptionsSetup(optionsSetup: OptionsSetupBlock) -> ChainableCommand { 0033 optionsSetupBlock = optionsSetup 0034 return self 0035 } 0036 0037 public func withUnrecognizedOptionsPrintingBehavior(behavior: UnrecognizedOptionsPrintingBehavior) -> ChainableCommand { 0038 unrecognizedOptionsPrintingBehavior = behavior 0039 return self 0040 } 0041 0042 public func withFailOnUnrecognizedOptions(shouldFail: Bool) -> ChainableCommand { 0043 failOnUnrecognizedOptions = shouldFail 0044 return self 0045 } 0046 0047 public func withExecutionBlock(execution: ExecutionBlock) -> ChainableCommand { 0048 executionBlock = execution 0049 return self 0050 } 0051 0052 }
CLI.swift:75 let chainable = ChainableCommand(commandName: commandName)