4 /// Sets up and returns a new options parser
6 /// - Returns: A Dictionary of Options, and a new CommandLineKit instance
7 func createParser() -> ([String:Option], CommandLineKit) {
9 let parser = CommandLineKit()
10 var flags: [String:Option] = [:]
12 flags["help"] = BoolOption(shortFlag: "h", longFlag: "help", helpMessage: "Prints a help message.")
13 flags["version"] = BoolOption(shortFlag: "v", longFlag: "version", helpMessage: "Prints the version.")
15 parser.addOptions(Array(flags.values))
17 return (flags, parser)
22 let (flags, parser) = createParser()
28 parser.printUsage(error)
32 if let helpFlag = flags["help"] as? BoolOption {
33 if helpFlag.value == true {
39 if let versionFlag = flags["version"] as? BoolOption {
40 if versionFlag.value == true {
41 print(Lyricli.version)