parser.addOptions(Array(flags.values))
+ parser.formatOutput = {parseString, type in
+
+ var formattedString: String
+
+ switch(type) {
+ case .About:
+ formattedString = "\(parseString) [<artist_name> <song_name>]"
+ break
+ default:
+ formattedString = parseString
+ }
+
+ return parser.defaultFormat(formattedString, type: type)
+ }
+
return (flags, parser)
}
if let titleFlag = flags["title"] as? BoolOption {
if titleFlag.value == true {
- Lyricli.printTitle()
+ Lyricli.showTitle = true
}
}
+ // Remove any flags so anyone after this gets the unprocessed values
+ let programName: [String] = [CommandLine.arguments[0]]
+ CommandLine.arguments = programName + parser.unparsedArguments
+
Lyricli.printLyrics()
}