Add tag_find implementation in Nim lang
[experiments.git] / tag_find / tag_find.nim
1 import os
2 import strutils
3
4 let currentDir = splitPath(currentSourcePath).head
5 let inputDir = paramStr(1)
6
7 let searchDir = if inputDir.len != 0 : inputDir else: currentDir
8
9 let searchTerm = "#+"
10
11 for file_name in walkDirRec(searchDir):
12 let contents = readFile(file_name)
13 let lines = contents.split('\n')
14 for line in lines:
15 if line.startsWith(searchTerm):
16 echo file_name