1 // Source that reads track artist and name from the command line
2 class ArgumentsSource: Source {
4 // Returns a track based on the arguments. It assumes the track artist
5 // will be the first argument, and the name will be the second, excluding
7 var currentTrack: Track? {
9 if CommandLine.arguments.count >= 3 {
10 // expected usage: $ ./lyricli <artist> <name>
11 let trackName: String = CommandLine.arguments[2]
12 let trackArtist: String = CommandLine.arguments[1]
14 return Track(withName: trackName, andArtist: trackArtist)