]> njoseph.me Git - nimcoon.git/commitdiff
Minor formatting changes
authorJoseph Nuthalapati <njoseph@riseup.net>
Tue, 16 Jun 2020 01:56:22 +0000 (07:26 +0530)
committerJoseph Nuthalapati <njoseph@riseup.net>
Tue, 16 Jun 2020 01:56:22 +0000 (07:26 +0530)
src/lib.nim
src/nimcoon.nim

index ccd1a39797f990c90c870f52d72bc72f179150ec..d36e2c22d718e09a233723ec8b011cdf9385d8f7 100644 (file)
@@ -27,9 +27,8 @@ type
   SelectionRange* = tuple[begin: int, until: int]
 
 
-# poEchoCmd can be added to options for debugging
 let
-  processOptions = {poStdErrToStdOut, poUsePath}
+  processOptions = {poStdErrToStdOut, poUsePath} # poEchoCmd can be added to options for debugging
   PEERTUBE_REGEX = re"videos\/watch\/[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}"
 
 
@@ -54,7 +53,7 @@ proc getYoutubePage*(searchQuery: string): string =
 
 
 proc getPeerTubeMagnetLink(url: string): string =
-  # Gets the magnet link of the best possible resolutino from PeerTube
+  ## Gets the magnet link of the best possible resolution from PeerTube
   let uuid = url.substr(find(url, PEERTUBE_REGEX) + "videos/watch/".len)
   let domainName = url.substr(8, find(url, '/', start=8) - 1)
   let apiURL = &"https://{domainName}/api/v1/videos/{uuid}"
@@ -74,7 +73,7 @@ func extractTitlesAndUrls*(html: string): SearchResults =
 proc presentVideoOptions*(searchResults: SearchResults) =
   eraseScreen()
   for index, (title, url) in searchResults:
-    styledEcho $index, ". ", styleBright, fgMagenta, title, "\n", resetStyle, fgCyan, url, "\n"
+    styledEcho $index, ". ", styleBright, fgMagenta, title, "\n", resetStyle, fgCyan, "   ", url, "\n"
 
 
 func isPlaylist(url: string): bool =
index 20b9280c54d990af5889176440d7ca1417842949..265409d082a8eb47ec95d684707defbe85ca5dc1 100644 (file)
@@ -31,11 +31,11 @@ proc parseArguments(): CommandLineOptions =
 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]}"
-     return false
-  true
+     result = false
 
 proc main() =
   let