-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathnimblef.nim
43 lines (36 loc) · 952 Bytes
/
nimblef.nim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import os, strutils, sequtils, parseopt, re
import docopt
include utils/argsBuilder, utils/streamBuilder
const doc = """
Usage: nf [<searchterm>] [options]
Options:
--help show this help message and exit
--no-ignore do not ignore files and folders specified in .gitignore
--hidden search hidden files
-s case sensitive search
--colors color search results
Try: nf
nf mydocument.txt
nf --no-ignore
nf controller -s --colors
"""
proc main =
let
argsSeq = toSeq(getopt())
args = docopt(doc)
searchTerm = if args["<searchterm>"]: $args["<searchterm>"] else: ""
currDir = getCurrentDir()
caseSensitive = args["-s"]
noIgnore = args["--no-ignore"]
hidden = args["--hidden"]
colors = args["--colors"]
parsed = buildIgnored(noIgnore)
buildStream(currDir,
colors,
searchTerm,
caseSensitive,
hidden,
parsed,
currDir
)
main()