Guest User

Untitled

a guest
Nov 26th, 2018
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nim 0.47 KB | None | 0 0
  1. import os, strutils, sequtils
  2.  
  3. let currDir: string = getCurrentDir()
  4. proc listFiles(dir: string, ignored: seq) =
  5.   for kind, path in walkDir(dir):
  6.     if kind == pcFile and any(ignored, proc (i: string): bool = return contains(kind, i)):
  7.       echo replace(path, currDir)
  8.     else:
  9.       listFiles(path, ignored)
  10.  
  11. var f: File
  12. if open(f,".gitignore"):
  13.   let ignored: seq = toSeq(lines(f))
  14.   listFiles(currDir, ignored)
  15. else:
  16.   listFiles(currDir, newSeqWith(0, 0))
Advertisement
Add Comment
Please, Sign In to add comment