X-Git-Url: https://njoseph.me/gitweb/nimcoon.git/blobdiff_plain/427e87f9d63a2514a8f31ba915e934fcab8399a2..6f161e0bd890c7289b54ad8ccfd5b73a416ea478:/src/lib.nim diff --git a/src/lib.nim b/src/lib.nim index 53c2e5d..8315473 100644 --- a/src/lib.nim +++ b/src/lib.nim @@ -8,6 +8,7 @@ import std/[terminal], strtabs, strutils, + tables, uri, xmltree @@ -15,7 +16,8 @@ import config type SearchResult* = tuple[title: string, url: string] - CommandLineOptions* = tuple[searchQuery: string, musicOnly: bool, feelingLucky: bool, fullScreen: bool] + Options* = Table[string, bool] + CommandLineOptions* = tuple[searchQuery: string, options: Options] let processOptions = {poStdErrToStdOut, poUsePath} @@ -40,7 +42,7 @@ func extractTitlesAndUrls*(html: string): seq[SearchResult] = map(a => (a.attrs["title"], "https://www.youtube.com" & a.attrs["href"])) proc presentVideoOptions*(searchResults: seq[SearchResult]) = - echo "" + eraseScreen() for index, (title, url) in searchResults: styledEcho $index, ". ", styleBright, fgMagenta, title, "\n", resetStyle, fgCyan, url, "\n"