]> njoseph.me Git - nimcoon.git/blobdiff - clitube.nim
Use less dangerous ways of joining strings
[nimcoon.git] / clitube.nim
index 3714c13612433ed295690aec1a41063ecfde2110..a9642916326dfd6a13a472b6045c74d3cade3656 100644 (file)
@@ -53,7 +53,6 @@ for kind, key, value in getopt():
   of cmdEnd:
     discard
 
-let noVideo = if musicOnly: "--no-video" else: ""
 
 if "https://www.youtube.com" in searchQuery:
   discard execProcess(&"{player} {searchQuery}")
@@ -69,5 +68,10 @@ let number = parseInt(readLine(stdin))
 
 styledEcho "\n", fgGreen, "Playing ", styleBright, fgMagenta, searchResults[number].title
 
+var command = @[player, searchResults[number].url]
+
+if musicOnly:
+  command.add("--no-video")
+
 # Play the video using the preferred/available media player
-discard execProcess(&"{player} {noVideo} {searchResults[number].url}")
+discard execProcess(command.join(" "))