mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-03 03:32:32 +00:00
better default for nimgrep
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user