0001 // 0002 // Extensions.swift 0003 // Example 0004 // 0005 // Created by Jake Heiser on 4/1/15. 0006 // Copyright (c) 2015 jakeheis. All rights reserved. 0007 // 0008 0009 extension String { 0010 0011 func padFront(totalLength totalLength: Int) -> String { 0012 var spacing = "" 0013 for _ in 0...totalLength { 0014 spacing += " " 0015 } 0016 0017 return "\(spacing)\(self)" 0018 } 0019 0020 func trimEndsByLength
HelpCommand.swift:45 let description = command.commandShortDescription.padFront(totalLength: 20 - command.commandName.characters.count)Options.swift:26 let paddedUsage = usage.padFront(totalLength: 40 - flagsString.characters.count)Options.swift:52 let paddedUsage = usage.padFront(totalLength: 40 - firstPart.characters.count)(trimLength: Int) -> String { 0021 let firstIndex = startIndex.advancedBy(trimLength) 0022 let lastIndex = endIndex.advancedBy(-trimLength) 0023 return substringWithRange(Range(start: firstIndex, end: lastIndex)) 0024 } 0025 0026 } 0027 0028 extension Array { 0029 0030 func each
CommandSignature.swift:34 required(parameter.trimEndsByLength(1))CommandSignature.swift:36 optional(parameter.trimEndsByLength(2))(block: (object: Element) -> ()) { 0031 for object in self { 0032 block(object: object) 0033 } 0034 } 0035 0036 func eachWithIndex
CLI.swift:65 commands.each { self.registerCommand($0) }Options.swift:110 flagOption.flags.each { self.allFlagOptions[$0] = flagOption }Options.swift:116 keyOption.keys.each { self.allKeyOptions[$0] = keyOption }Options.swift:123 rawArguments.unclassifiedArguments().each {(argument) in(block: (object: Element, index: Int) -> ()) { 0037 for (index, object) in self.enumerate() { 0038 block(object: object, index: index) 0039 } 0040 } 0041 0042 }
RawArguments.swift:65 arguments.eachWithIndex {(argument, index) in