]> git.r.bdr.sh - rbdr/lyricli/commitdiff
Add all options from original lyricli
authorBen Beltran <redacted>
Sun, 13 Nov 2016 05:55:27 +0000 (23:55 -0600)
committerBen Beltran <redacted>
Sun, 13 Nov 2016 05:55:27 +0000 (23:55 -0600)
Options are mocked but pointing to correct place in library

Sources/Lyricli.swift
Sources/main.swift

index 669dac970a4c6e9f7bc65708e14e316060906bd7..6c73e028e2ae23a0f8057ee0d5d594b4ba1c00ba 100644 (file)
@@ -1,3 +1,28 @@
+/// The main Lyricli interface
 public class Lyricli {
     public static var version = "0.0.0-feature/option-parsing"
+
+    public static func printLyrics() {
+        print("Getting Lyrics: Not yet implemented")
+    }
+
+    public static func printTitle() {
+        print("Getting Song Title: Not yet implemented")
+    }
+
+    public static func printSources() {
+        print("Listing Sources: Not yet implemented")
+    }
+
+    public static func enableSource(_ sourceName: String) {
+        print("Enable source \(sourceName): Not yet implemented")
+    }
+
+    public static func disableSource(_ sourceName: String) {
+        print("Disable source \(sourceName): Not yet implemented")
+    }
+
+    public static func resetSource(_ sourceName: String) {
+        print("Reset source \(sourceName): Not yet implemented")
+    }
 }
index b4d3ebfe4f11382d61ab1b93964160941f665cd4..47720ad3a631b15d7feed0637520a729bf3c8662 100644 (file)
@@ -12,6 +12,13 @@ func createParser() -> ([String:Option], CommandLineKit) {
     flags["help"] = BoolOption(shortFlag: "h", longFlag: "help", helpMessage: "Prints a help message.")
     flags["version"] = BoolOption(shortFlag: "v", longFlag: "version", helpMessage: "Prints the version.")
 
+    flags["enableSource"] = StringOption(shortFlag: "e", longFlag: "enable-source", helpMessage: "Enables a source")
+    flags["disableSource"] = StringOption(shortFlag: "d", longFlag: "disable-source", helpMessage: "Disables a source")
+    flags["resetSource"] = StringOption(shortFlag: "r", longFlag: "reset-source", helpMessage: "Resets a source")
+    flags["listSources"] = BoolOption(shortFlag: "l", longFlag: "list-sources", helpMessage: "Lists all sources")
+
+    flags["title"] = BoolOption(shortFlag: "t", longFlag: "title", helpMessage: "Shows title of song if true")
+
     parser.addOptions(Array(flags.values))
 
     return (flags, parser)
@@ -31,18 +38,53 @@ func main() {
 
     if let helpFlag = flags["help"] as? BoolOption {
         if helpFlag.value == true {
-                parser.printUsage()
-                exit(0)
-            }
+            parser.printUsage()
+            exit(0)
+        }
     }
 
     if let versionFlag = flags["version"] as? BoolOption {
         if versionFlag.value == true {
-                print(Lyricli.version)
-                exit(0)
-            }
+            print(Lyricli.version)
+            exit(0)
+        }
+    }
+
+    if let listSourcesFlag = flags["listSources"] as? BoolOption {
+        if listSourcesFlag.value == true {
+            Lyricli.printSources()
+            exit(0)
+        }
+    }
+
+    if let enableSourceFlag = flags["enableSource"] as? StringOption {
+        if let source = enableSourceFlag.value {
+            Lyricli.enableSource(source)
+            exit(0)
+        }
+    }
+
+    if let disableSourceFlag = flags["disableSource"] as? StringOption {
+        if let source = disableSourceFlag.value {
+            Lyricli.disableSource(source)
+            exit(0)
+        }
+    }
+
+    if let resetSourceFlag = flags["resetSource"] as? StringOption {
+        if let source = resetSourceFlag.value {
+            Lyricli.resetSource(source)
+            exit(0)
+        }
+    }
+
+    if let titleFlag = flags["title"] as? BoolOption {
+        if titleFlag.value == true {
+            Lyricli.printTitle()
+        }
     }
 
+    Lyricli.printLyrics()
 }
 
 main()