0001 // 0002 // HelpCommand.swift 0003 // SwiftCLI 0004 // 0005 // Created by Jake Heiser on 7/25/14. 0006 // Copyright (c) 2014 jakeheis. All rights reserved. 0007 // 0008 0009 public class HelpCommand: CommandType { 0010 0011 var allCommands
CLI.swift:19 public static var helpCommand: HelpCommand? = HelpCommand()CLI.swift:19 public static var helpCommand: HelpCommand? = HelpCommand(): [CommandType] = [] 0012 0013 public var commandName: String { 0014 return "help" 0015 } 0016 0017 public var commandSignature: String { 0018 return "" 0019 } 0020 0021 public var commandShortDescription: String { 0022 return "Prints this help information" 0023 } 0024 0025 public var commandShortcut: String? { 0026 return "-h" 0027 } 0028 0029 public var failOnUnrecognizedOptions: Bool { 0030 return false 0031 } 0032 0033 public func execute(arguments: CommandArguments) throws { 0034 print("\(CLI.appDescription)\n") 0035 print("Available commands: ") 0036 0037 for command in allCommands { 0038 printCommand(command) 0039 } 0040 0041 printCommand(self) 0042 } 0043 0044 func printCommand
CLI.swift:133 hc.allCommands = commandsHelpCommand.swift:37 for command in allCommands {(command: CommandType) { 0045 let description = command.commandShortDescription.padFront(totalLength: 20 - command.commandName.characters.count) 0046 print("- \(command.commandName)\(description)") 0047 } 0048 0049 }
HelpCommand.swift:38 printCommand(command)HelpCommand.swift:41 printCommand(self)