diff options
| author | Ben Beltran <ben@nsovocal.com> | 2017-05-18 19:38:15 -0500 |
|---|---|---|
| committer | Ben Beltran <ben@nsovocal.com> | 2017-05-18 19:38:15 -0500 |
| commit | b3320a26c57711ae7167f4549338bd0792dbe570 (patch) | |
| tree | bca17656820ba12db12a63f7d94764a857a5a8c7 /Sources/arguments_source.swift | |
| parent | 1f7088f6391dfbffcd8f243f8d1509be8a209604 (diff) | |
| parent | a968bff7e21c9372deca5fce5921999b45d5d348 (diff) | |
Merge branch 'feature/read-song-from-command-line' into develop
Diffstat (limited to 'Sources/arguments_source.swift')
| -rw-r--r-- | Sources/arguments_source.swift | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Sources/arguments_source.swift b/Sources/arguments_source.swift new file mode 100644 index 0000000..c07c952 --- /dev/null +++ b/Sources/arguments_source.swift @@ -0,0 +1,17 @@ +/// Source that deals with command line +class ArgumentsSource: Source { + public var currentTrack: Track? { + get { + if CommandLine.arguments.count >= 3 { + + // expected usage: $ ./lyricli <artist> <name> + + let trackName: String = CommandLine.arguments[2] + let trackArtist: String = CommandLine.arguments[1] + + return Track(withName: trackName, andArtist: trackArtist) + } + return nil + } + } +} |