parent
654a20166e
commit
7e21218a07
20 changed files with 183 additions and 164 deletions
|
|
@ -1,14 +1,11 @@
|
|||
.. default-role:: code
|
||||
|
||||
=========================
|
||||
nimgrep User's manual
|
||||
=========================
|
||||
|
||||
.. default-role:: literal
|
||||
|
||||
:Author: Andreas Rumpf
|
||||
:Version: 1.6.0
|
||||
|
||||
.. default-role:: option
|
||||
.. contents::
|
||||
|
||||
Nimgrep is a command line tool for search and replace tasks. It can search for
|
||||
|
|
@ -23,11 +20,12 @@ Apart from that it is a generic text manipulation tool.
|
|||
Installation
|
||||
============
|
||||
|
||||
Compile nimgrep with the command::
|
||||
Compile nimgrep with the command:
|
||||
|
||||
.. code:: cmd
|
||||
nim c -d:release tools/nimgrep.nim
|
||||
|
||||
And copy the executable somewhere in your `$PATH`.
|
||||
And copy the executable somewhere in your ``$PATH``.
|
||||
|
||||
|
||||
Command line switches
|
||||
|
|
@ -40,31 +38,32 @@ Examples
|
|||
|
||||
All examples below use default PCRE Regex patterns:
|
||||
|
||||
+ To search recursively in Nim files using style-insensitive identifiers::
|
||||
+ To search recursively in Nim files using style-insensitive identifiers:
|
||||
|
||||
--recursive --ext:'nim|nims' --ignoreStyle
|
||||
.. code:: cmd
|
||||
nimgrep --recursive --ext:'nim|nims' --ignoreStyle
|
||||
# short: -r --ext:'nim|nims' -y
|
||||
|
||||
.. Note:: we used `'` quotes to avoid special treatment of `|` symbol
|
||||
for shells like Bash
|
||||
|
||||
+ To exclude version control directories (Git, Mercurial=hg, Subversion=svn)
|
||||
from the search::
|
||||
from the search:
|
||||
|
||||
--excludeDir:'^\.git$' --excludeDir:'^\.hg$' --excludeDir:'^\.svn$'
|
||||
.. code:: cmd
|
||||
nimgrep --excludeDir:'^\.git$' --excludeDir:'^\.hg$' --excludeDir:'^\.svn$'
|
||||
# short: --ed:'^\.git$' --ed:'^\.hg$' --ed:'^\.svn$'
|
||||
|
||||
+ To search only in paths containing the `tests` sub-directory recursively::
|
||||
|
||||
--recursive --includeDir:'(^|/)tests($|/)'
|
||||
.. code:: cmd
|
||||
nimgrep --recursive --includeDir:'(^|/)tests($|/)'
|
||||
# short: -r --id:'(^|/)tests($|/)'
|
||||
|
||||
.. Attention:: note the subtle difference between `--excludeDir` and
|
||||
`--includeDir`: the former is applied to relative directory entries
|
||||
.. Attention:: note the subtle difference between `--excludeDir`:option: and
|
||||
`--includeDir`:option:\: the former is applied to relative directory entries
|
||||
and the latter is applied to the whole paths
|
||||
|
||||
+ Nimgrep can search multi-line, e.g. to find files containing `import`
|
||||
and then `strutils` use::
|
||||
|
||||
'import(.|\n)*?strutils'
|
||||
and then `strutils` use pattern `'import(.|\n)*?strutils'`:option:.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue