import
parseopt,
- strformat,
strutils,
tables
"feelingLucky": false,
"fullScreen": false,
"download": false,
- "non-interactive": false
+ "nonInteractive": false,
+ "autoPlay": false
})
+ # Non-interactive/Global options
for kind, key, value in getopt():
case kind
of cmdArgument:
of "l", "lucky": options["feelingLucky"] = true
of "f", "full-screen": options["fullScreen"] = true
of "d", "download": options["download"] = true
- of "n", "non-interactive": options["non-interactive"] = true
+ of "n", "non-interactive": options["nonInteractive"] = true
+ of "a", "auto-play": options["autoPlay"] = true
of cmdEnd: discard
if searchQuery == "":
(searchQuery, options)
-proc isValidOptions*(options: Options): bool =
- # Check for invalid combinations of options
- var invalidCombinations = [("musicOnly", "fullScreen"), ("download", "fullScreen")]
- result = true
- for combination in invalidCombinations:
- if options[combination[0]] and options[combination[1]]:
- stderr.writeLine fmt"Incompatible options provided: {combination[0]} and {combination[1]}"
- result = false
-
-
proc main() =
let
player = selectMediaPlayer()
quit(0)
let searchResults = getSearchResults(searchQuery)
- if options["non-interactive"]:
+ if options["nonInteractive"]:
for index, (title, url) in searchResults:
echo title
echo url