]> git.r.bdr.sh - rbdr/lyricli/blob - Sources/arguments_source.swift
c07c9522102cb8a125c6dfcd35009f50fad094e9
[rbdr/lyricli] / Sources / arguments_source.swift
1 /// Source that deals with command line
2 class ArgumentsSource: Source {
3 public var currentTrack: Track? {
4 get {
5 if CommandLine.arguments.count >= 3 {
6
7 // expected usage: $ ./lyricli <artist> <name>
8
9 let trackName: String = CommandLine.arguments[2]
10 let trackArtist: String = CommandLine.arguments[1]
11
12 return Track(withName: trackName, andArtist: trackArtist)
13 }
14 return nil
15 }
16 }
17 }