import os, docopt, tables, md5, iterutils, re proc studyDir(root: string, ignore: Iterable[string]): TableRef[string, string] = result = newTable[string, string]() for path in walkDirRec(root): var relPath = substr(path, len(root)) if foldl(ignore, proc (acc: bool, it: string): bool = acc and match(relPath, re(it)), true): continue var fileInfo = getFileInfo(path) if fileInfo.kind == pcFile: result.add(relPath, $(toMD5(readFile(path)))) elif fileInfo.kind == pcDir: result.add(relPath, "directory") when isMainModule: let doc = """ treediff Usage: treediff [-i ]... []... treediff (-h | --help) treediff (-v | --version) Options: -h --help Show this usage information. -v --version Show the program version. """ let args = docopt(doc, version = "treediff 0.1") for root in @(args[""]): echo "Looking at ", root echo studyDir(root, @(args[""])) echo ""