230609.4 · ee85b713aa84e0050a3b36030000778ccfd4882f
Renamed executable from hg to hgrep (to avoid Mercurial conflict)
reading declarations
Changes to doc/USAGE.md. All files
@@ -219,7 +219,7 @@ Running in the `/usr` directory and searching for any shared library, here's the | --- | --- | --- | | `find . -name "*.so" \| wc -l` | 1851 | 0.293 | | `rg -g "*.so" --files \| wc -l` | 1621 | 0.082 |-| `hg --filter '\.so$' --files \| wc -l` | 1621 | **0.043** |+| `hgrep --filter '\.so$' --files \| wc -l` | 1621 | **0.043** | ### Negating the Filter @@ -254,7 +254,7 @@ NOTE in the following example: 1. `ls` command shows all the files and directories in the current path - Note the `build/` folder 2. `git ls-files` shows all the files in the git index and the working tree-3. `hg --files` output is very similar to `git ls-files` except that hidden files are ignored. +3. `hgrep --files` output is very similar to `git ls-files` except that hidden files are ignored. `hypergrep` prefers this approach of iterating the git index rather than loading the `.gitignore` file and checking every single file and subdirectory against a potentially long list of ignore rules. @@ -267,12 +267,12 @@ NOTE If you don't like that `hypergrep` treats git repositories differently, and # Usage ```bash-hg [OPTIONS] PATTERN [PATH ...]-hg [OPTIONS] -e PATTERN ... [PATH ...]-hg [OPTIONS] -f PATTERNFILE ... [PATH ...]-hg [OPTIONS] --files [PATH ...]-hg [OPTIONS] --help-hg [OPTIONS] --version+hgrep [OPTIONS] PATTERN [PATH ...]+hgrep [OPTIONS] -e PATTERN ... [PATH ...]+hgrep [OPTIONS] -f PATTERNFILE ... [PATH ...]+hgrep [OPTIONS] --files [PATH ...]+hgrep [OPTIONS] --help+hgrep [OPTIONS] --version ``` # Options@@ -283,10 +283,10 @@ hg [OPTIONS] --version | `--column` | Show column numbers (1-based). This only shows the column numbers for the first match on each line. | | `-c, --count` | This flag suppresses normal output and shows the number of lines that match the given pattern for each file searched | | `--count-matches` | This flag suppresses normal output and shows the number of individual matches of the given pattern for each file searched | -| `-e, --regexp <PATTERN>...` | A pattern to search for. This option can be provided multiple times, where all patterns given are searched. Lines matching at least one of the provided patterns are printed, e.g.,<br/><br/>`hg -e 'myFunctionCall' -e 'myErrorCallback'`<br/><br/>will search for any occurrence of either of the patterns. |+| `-e, --regexp <PATTERN>...` | A pattern to search for. This option can be provided multiple times, where all patterns given are searched. Lines matching at least one of the provided patterns are printed, e.g.,<br/><br/>`hgrep -e 'myFunctionCall' -e 'myErrorCallback'`<br/><br/>will search for any occurrence of either of the patterns. | | `-f, --files <PATTERNFILE>...` | Search for patterns from the given file, with one pattern per line. When this flag is used multiple times or in combination with the `-e/---regexp` flag, then all patterns provided are searched. | | `--files` | Print each file that would be searched without actually performing the search |-| `--filter <FILTERPATTERN>` | Filter paths based on a regex pattern, e.g.,<br/><br/>`hg --filter '(include\|src)/.*\.(c\|cpp\|h\|hpp)$'`<br/><br/>will search C/C++ files in the any `*/include/*` and `*/src/*` paths.<br/><br/>A filter can be negated by prefixing the pattern with !, e.g.,<br/><br/>`hg --filter '!\.html$'`<br/><br/>will search any files that are not HTML files. |+| `--filter <FILTERPATTERN>` | Filter paths based on a regex pattern, e.g.,<br/><br/>`hgrep --filter '(include\|src)/.*\.(c\|cpp\|h\|hpp)$'`<br/><br/>will search C/C++ files in the any `*/include/*` and `*/src/*` paths.<br/><br/>A filter can be negated by prefixing the pattern with !, e.g.,<br/><br/>`hgrep --filter '!\.html$'`<br/><br/>will search any files that are not HTML files. | | `-F, --fixed-strings` | Treat the pattern as a literal string instead of a regex. Special regex meta characters such as `.(){}*+` do not need to be escaped. | | `-h, --help` | Display help message. | | `--hidden` | Search hidden files and directories. By default, hidden files and directories are skipped. A file or directory is considered hidden if its base name starts with a dot character (`'.'`). |@@ -297,7 +297,7 @@ hg [OPTIONS] --version | `-I, --no-filename` | Never print the file path with the matched lines. This is the default when searching one file or stdin. | | `-l, --files-with-matches` | Print the paths with at least one match and suppress match contents. | | `-M, --max-columns <NUM>` | Don't print lines longer than this limit in bytes. Longer lines are omitted, and only the number of matches in that line is printed. |-| `--max-filesize <NUM+SUFFIX?>` | Ignore files above a certain size. The input accepts suffixes of form `K`, `M` or `G`. If no suffix is provided the input is treated as bytes e.g.,<br/><br/>`hg --max-filesize 50K`<br/><br/>will search any files under `50KB` in size. |+| `--max-filesize <NUM+SUFFIX?>` | Ignore files above a certain size. The input accepts suffixes of form `K`, `M` or `G`. If no suffix is provided the input is treated as bytes e.g.,<br/><br/>`hgrep --max-filesize 50K`<br/><br/>will search any files under `50KB` in size. | | `-n, --line-number` | Show line numbers (1-based). This is enabled by defauled when searching in a terminal. | | `-N, --no-line-number` | Suppress line numbers. This is enabled by default when not searching in a terminal. | | `-o, --only-matching` | Print only matched parts of a matching line, with each such part on a separate output line. |