diff --git a/routes.nim b/routes.nim index d704089..fefbfef 100644 --- a/routes.nim +++ b/routes.nim @@ -771,11 +771,11 @@ proc tasks*( let res = await process.waitForExit(InfiniteDuration) #TODO handle error (i.e. no nimble file) let output = await process.stdoutStream.readLine() - echo output.splitLines.toSeq var name, desc: string for line in output.splitLines: if scanf(line, "$+ $*", name, desc): - if line.substr(name.len)[0 .. 1] == " " and line.substr(name.len + 2) == desc: + #first run of nimble tasks can compile nim and output the result of the compilation + if name.isWord: result.add NimbleTask(name: name.strip(), description: desc.strip()) #Notifications diff --git a/utils.nim b/utils.nim index 08a22a4..bcde0b1 100644 --- a/utils.nim +++ b/utils.nim @@ -300,3 +300,10 @@ proc getNextFreePort*(): Port = let (_, port) = s.getLocalAddr s.close() port + +func isWord*(str: string): bool = + var str = str.toLower() + for c in str: + if c.int notin 97 .. 122: + return false + return true