better default for nimgrep

This commit is contained in:
Araq
2019-05-16 12:59:44 +02:00
committed by Andreas Rumpf
parent 23dbc9ad58
commit 845f89ab54

View File

@@ -11,7 +11,7 @@ import
os, strutils, parseopt, pegs, re, terminal
const
Version = "1.2"
Version = "1.3"
Usage = "nimgrep - Nim Grep Utility Version " & Version & """
(c) 2012 Andreas Rumpf
@@ -33,7 +33,7 @@ Options:
--ignoreStyle, -y be style insensitive
--ext:EX1|EX2|... only search the files with the given extension(s)
--nocolor output will be given without any colours.
--oneline show file on each matched line
--group group matches by file
--verbose be verbose: list every processed file
--filenames find the pattern in the filenames, not in the contents
of the file
@@ -268,6 +268,7 @@ proc checkOptions(subset: TOptions, a, b: string) =
if subset <= options:
quit("cannot specify both '$#' and '$#'" % [a, b])
oneline = true
for kind, key, val in getopt():
case kind
of cmdArgument:
@@ -298,6 +299,7 @@ for kind, key, val in getopt():
of "ext": extensions.add val.split('|')
of "nocolor": useWriteStyled = false
of "oneline": oneline = true
of "group": oneline = false
of "verbose": incl(options, optVerbose)
of "filenames": incl(options, optFilenames)
of "help", "h": writeHelp()