From 4425e9001e20e891dab7711644f83a1628788b47 Mon Sep 17 00:00:00 2001 From: Ben Beltran Date: Wed, 17 May 2017 23:06:25 -0500 Subject: Add the arguments source --- Sources/arguments_source.swift | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Sources/arguments_source.swift (limited to 'Sources/arguments_source.swift') 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 + + let trackName: String = CommandLine.arguments[2] + let trackArtist: String = CommandLine.arguments[1] + + return Track(withName: trackName, andArtist: trackArtist) + } + return nil + } + } +} -- cgit