Skip to content

Commit

Permalink
released 4.4.0
Browse files Browse the repository at this point in the history
- installs bash autocompletion #327
- installs fish and zsh autocompletions #198
- TUI ALT-SHIFT-% switches between "bool lines" mode, "bool files" mode and off
- TUI boolF mode (`-%FQ`) now applies syntax highlighting
- option `-t` (`--file-type`) now also accepts filename extensions as shortcuts, when unambiguous, for example `-tpy` for `-tpython` #333
- support legacy grep long options without `=` for option arguments, like GNU grep does
  • Loading branch information
genivia-inc committed Dec 18, 2023
1 parent de39a08 commit 0bdc215
Show file tree
Hide file tree
Showing 32 changed files with 761 additions and 693 deletions.
203 changes: 97 additions & 106 deletions README.md

Large diffs are not rendered by default.

Binary file modified bin/win32/ugrep.exe
Binary file not shown.
Binary file modified bin/win64/ugrep.exe
Binary file not shown.
2 changes: 2 additions & 0 deletions completions/fish/compgen
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export ENCODING=$($UGREP --encoding=list 2>&1 | sed -e 's/^.[a-z].*are//' -e '/h
# add -xa 'arguments' to --hexdump
# add -xa 'arguments' to --sort=KEY
# add -xa 'arguments' to --fuzzy=
# add -r to -e, -f, -g, -J, -K, -M, -m, -N, -O
$UGREP --help 2>&1 \
| sed -E -e '/^[ ]{4}-/s/ -([^-])([[ ][^ ]*|,|$)/ -s \1/g' -e $'/^[ ]{4}-/s/ -([^-][^-, ]+)/ -o \'\\1\'/g' -e '/^[ ]{4}-/s/--([-a-z]+)[^ ]*/-l \1/g' -e '/^[ ]{4}-/s/$/ -d/' \
| sed -E -e '/^[ ]{4}-/s/ \[-e\] PATTERN| \[OPTIONS\]| \[WHAT\]| \.\.\.|,//g' \
Expand All @@ -37,6 +38,7 @@ $UGREP --help 2>&1 \
| sed -e "s/^-l hexdump /&-xa '1a 2a 4ah 6ah 8ah 1aC1 2aC1 4ahC1 6ahC1 8ahC1' /" \
| sed -e "s/^-l sort /&-xa 'name best size changed created used rname rbest rsize rchanged rcreated rused' /" \
| sed -e "s/^-s Z -l fuzzy /&-xa '1 +1 -1 ~1 +-1 +~1 +-~1 -~1 best1 best+1 best-1 best~1 best+-1 best+~1 best+-~1 best-~1' /" \
| sed -e "s/^-s [efgJKMmNO]/& -r/" \
>> ug.tmp

cat ug.tmp | sed -e '/^[^#]/s/^/complete -c ug /' > ug.fish
Expand Down
18 changes: 9 additions & 9 deletions completions/fish/ug+.fish
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,20 @@ complete -c ug+ -l delay -d 'Set the default -Q key response delay'
complete -c ug+ -l depth -s 1 -s 2 -s 3 -s 9 -o '10' -o '11' -d 'Restrict recursive searches from MIN to MAX directory levels deep, where -1 (--depth=1) searches the specified path without recursing into subdirectories'
complete -c ug+ -l dotall -d 'Dot . in regular expressions matches anything, including newline.'
complete -c ug+ -s E -l extended-regexp -d 'Interpret patterns as extended regular expressions (EREs)'
complete -c ug+ -s e -l regexp -d 'Specify a PATTERN to search the input'
complete -c ug+ -s e -r -l regexp -d 'Specify a PATTERN to search the input'
complete -c ug+ -l encoding -xa 'binary ASCII UTF-8 UTF-16 UTF-16BE UTF-16LE UTF-32 UTF-32BE UTF-32LE LATIN1 ISO-8859-1 ISO-8859-2 ISO-8859-3 ISO-8859-4 ISO-8859-5 ISO-8859-6 ISO-8859-7 ISO-8859-8 ISO-8859-9 ISO-8859-10 ISO-8859-11 ISO-8859-13 ISO-8859-14 ISO-8859-15 ISO-8859-16 MAC MACROMAN EBCDIC CP437 CP850 CP858 CP1250 CP1251 CP1252 CP1253 CP1254 CP1255 CP1256 CP1257 CP1258 KOI8-R KOI8-U KOI8-RU ' -d 'The encoding format of the input'
complete -c ug+ -l exclude -d 'Exclude files whose name matches GLOB, same as -g ^GLOB'
complete -c ug+ -l exclude-dir -d 'Exclude directories whose name matches GLOB from recursive searches, same as -g ^GLOB/'
complete -c ug+ -l exclude-from -d 'Read the globs from FILE and skip files and directories whose name matches one or more globs'
complete -c ug+ -l exclude-fs -d 'Exclude file systems specified by MOUNTS from recursive searches'
complete -c ug+ -s F -l fixed-strings -d 'Interpret pattern as a set of fixed strings, separated by newlines, any of which is to be matched'
complete -c ug+ -s f -l file -d 'Read newline-separated patterns from FILE'
complete -c ug+ -s f -r -l file -d 'Read newline-separated patterns from FILE'
complete -c ug+ -l filter -d 'Filter files through the specified COMMANDS first before searching'
complete -c ug+ -l filter-magic-label -d 'Associate LABEL with files whose signature "magic bytes" match the MAGIC regex pattern'
complete -c ug+ -l format -d 'Output FORMAT-formatted matches'
complete -c ug+ -l free-space -d 'Spacing (blanks and tabs) in regular expressions are ignored'
complete -c ug+ -s G -l basic-regexp -d 'Interpret patterns as basic regular expressions (BREs)'
complete -c ug+ -s g -l glob -l iglob -d 'Only search files whose name matches the specified comma-separated list of GLOBS, same as --include=glob for each glob in GLOBS'
complete -c ug+ -s g -r -l glob -l iglob -d 'Only search files whose name matches the specified comma-separated list of GLOBS, same as --include=glob for each glob in GLOBS'
complete -c ug+ -l glob-ignore-case -d 'Perform case-insensitive glob matching in general'
complete -c ug+ -l group-separator -d 'Use SEP as a group separator for context options -A, -B and -C'
complete -c ug+ -s H -l with-filename -d 'Always print the filename with output lines'
Expand All @@ -54,26 +54,26 @@ complete -c ug+ -l include-dir -d 'Only directories whose name matches GLOB are
complete -c ug+ -l include-from -d 'Read the globs from FILE and search only files and directories whose name matches one or more globs'
complete -c ug+ -l include-fs -d 'Only file systems specified by MOUNTS are included in recursive searches'
complete -c ug+ -l index -d 'Perform index-based recursive search'
complete -c ug+ -s J -l jobs -d 'Specifies the number of threads spawned to search files'
complete -c ug+ -s J -r -l jobs -d 'Specifies the number of threads spawned to search files'
complete -c ug+ -s j -l smart-case -d 'Perform case insensitive matching, unless a pattern is specified with a literal upper case ASCII letter'
complete -c ug+ -l json -d 'Output file matches in JSON'
complete -c ug+ -s K -l range -l min-line -l max-line -d 'Start searching at line MIN, stop at line MAX when specified'
complete -c ug+ -s K -r -l range -l min-line -l max-line -d 'Start searching at line MIN, stop at line MAX when specified'
complete -c ug+ -s k -l column-number -d 'The column number of a pattern match is displayed in front of the respective matched line, starting at column 1'
complete -c ug+ -s L -l files-without-match -d 'Only the names of files not containing selected lines are written to standard output'
complete -c ug+ -s l -l files-with-matches -d 'Only the names of files containing selected lines are written to standard output'
complete -c ug+ -l label -d 'Displays the LABEL value when input is read from standard input where a file name would normally be printed in the output'
complete -c ug+ -l line-buffered -d 'Force output to be line buffered instead of block buffered'
complete -c ug+ -l lines -d 'Boolean line matching mode for option --bool, the default mode'
complete -c ug+ -s M -l file-magic -d 'Only search files matching the magic signature pattern MAGIC'
complete -c ug+ -s m -l min-count -l max-count -d 'Require MIN matches, stop after MAX matches when specified'
complete -c ug+ -s M -r -l file-magic -d 'Only search files matching the magic signature pattern MAGIC'
complete -c ug+ -s m -r -l min-count -l max-count -d 'Require MIN matches, stop after MAX matches when specified'
complete -c ug+ -l match -d 'Match all input'
complete -c ug+ -l max-files -d 'Restrict the number of files matched to NUM'
complete -c ug+ -l mmap -d 'Use memory maps to search files'
complete -c ug+ -s N -l neg-regexp -d 'Specify a negative PATTERN to reject pattern matches that also match PATTERN'
complete -c ug+ -s N -r -l neg-regexp -d 'Specify a negative PATTERN to reject pattern matches that also match PATTERN'
complete -c ug+ -s n -l line-number -d 'Each output line is preceded by its relative line number in the file, starting at line 1'
complete -c ug+ -l no-group-separator -d 'Removes the group separator line from the output for context options -A, -B and -C'
complete -c ug+ -l not -d 'Specifies that PATTERN should not match'
complete -c ug+ -s O -l file-extension -d 'Only search files whose filename extensions match the specified comma-separated list of EXTENSIONS, same as -g *.ext for each'
complete -c ug+ -s O -r -l file-extension -d 'Only search files whose filename extensions match the specified comma-separated list of EXTENSIONS, same as -g *.ext for each'
complete -c ug+ -s o -l only-matching -d 'Only the matching part of a pattern match is output'
complete -c ug+ -l only-line-number -d 'Only the line number of a matching line is output'
complete -c ug+ -l files -o '%%' -d 'Boolean file matching mode, the opposite of --lines'
Expand Down
18 changes: 9 additions & 9 deletions completions/fish/ug.fish
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,20 @@ complete -c ug -l delay -d 'Set the default -Q key response delay'
complete -c ug -l depth -s 1 -s 2 -s 3 -s 9 -o '10' -o '11' -d 'Restrict recursive searches from MIN to MAX directory levels deep, where -1 (--depth=1) searches the specified path without recursing into subdirectories'
complete -c ug -l dotall -d 'Dot . in regular expressions matches anything, including newline.'
complete -c ug -s E -l extended-regexp -d 'Interpret patterns as extended regular expressions (EREs)'
complete -c ug -s e -l regexp -d 'Specify a PATTERN to search the input'
complete -c ug -s e -r -l regexp -d 'Specify a PATTERN to search the input'
complete -c ug -l encoding -xa 'binary ASCII UTF-8 UTF-16 UTF-16BE UTF-16LE UTF-32 UTF-32BE UTF-32LE LATIN1 ISO-8859-1 ISO-8859-2 ISO-8859-3 ISO-8859-4 ISO-8859-5 ISO-8859-6 ISO-8859-7 ISO-8859-8 ISO-8859-9 ISO-8859-10 ISO-8859-11 ISO-8859-13 ISO-8859-14 ISO-8859-15 ISO-8859-16 MAC MACROMAN EBCDIC CP437 CP850 CP858 CP1250 CP1251 CP1252 CP1253 CP1254 CP1255 CP1256 CP1257 CP1258 KOI8-R KOI8-U KOI8-RU ' -d 'The encoding format of the input'
complete -c ug -l exclude -d 'Exclude files whose name matches GLOB, same as -g ^GLOB'
complete -c ug -l exclude-dir -d 'Exclude directories whose name matches GLOB from recursive searches, same as -g ^GLOB/'
complete -c ug -l exclude-from -d 'Read the globs from FILE and skip files and directories whose name matches one or more globs'
complete -c ug -l exclude-fs -d 'Exclude file systems specified by MOUNTS from recursive searches'
complete -c ug -s F -l fixed-strings -d 'Interpret pattern as a set of fixed strings, separated by newlines, any of which is to be matched'
complete -c ug -s f -l file -d 'Read newline-separated patterns from FILE'
complete -c ug -s f -r -l file -d 'Read newline-separated patterns from FILE'
complete -c ug -l filter -d 'Filter files through the specified COMMANDS first before searching'
complete -c ug -l filter-magic-label -d 'Associate LABEL with files whose signature "magic bytes" match the MAGIC regex pattern'
complete -c ug -l format -d 'Output FORMAT-formatted matches'
complete -c ug -l free-space -d 'Spacing (blanks and tabs) in regular expressions are ignored'
complete -c ug -s G -l basic-regexp -d 'Interpret patterns as basic regular expressions (BREs)'
complete -c ug -s g -l glob -l iglob -d 'Only search files whose name matches the specified comma-separated list of GLOBS, same as --include=glob for each glob in GLOBS'
complete -c ug -s g -r -l glob -l iglob -d 'Only search files whose name matches the specified comma-separated list of GLOBS, same as --include=glob for each glob in GLOBS'
complete -c ug -l glob-ignore-case -d 'Perform case-insensitive glob matching in general'
complete -c ug -l group-separator -d 'Use SEP as a group separator for context options -A, -B and -C'
complete -c ug -s H -l with-filename -d 'Always print the filename with output lines'
Expand All @@ -54,26 +54,26 @@ complete -c ug -l include-dir -d 'Only directories whose name matches GLOB are i
complete -c ug -l include-from -d 'Read the globs from FILE and search only files and directories whose name matches one or more globs'
complete -c ug -l include-fs -d 'Only file systems specified by MOUNTS are included in recursive searches'
complete -c ug -l index -d 'Perform index-based recursive search'
complete -c ug -s J -l jobs -d 'Specifies the number of threads spawned to search files'
complete -c ug -s J -r -l jobs -d 'Specifies the number of threads spawned to search files'
complete -c ug -s j -l smart-case -d 'Perform case insensitive matching, unless a pattern is specified with a literal upper case ASCII letter'
complete -c ug -l json -d 'Output file matches in JSON'
complete -c ug -s K -l range -l min-line -l max-line -d 'Start searching at line MIN, stop at line MAX when specified'
complete -c ug -s K -r -l range -l min-line -l max-line -d 'Start searching at line MIN, stop at line MAX when specified'
complete -c ug -s k -l column-number -d 'The column number of a pattern match is displayed in front of the respective matched line, starting at column 1'
complete -c ug -s L -l files-without-match -d 'Only the names of files not containing selected lines are written to standard output'
complete -c ug -s l -l files-with-matches -d 'Only the names of files containing selected lines are written to standard output'
complete -c ug -l label -d 'Displays the LABEL value when input is read from standard input where a file name would normally be printed in the output'
complete -c ug -l line-buffered -d 'Force output to be line buffered instead of block buffered'
complete -c ug -l lines -d 'Boolean line matching mode for option --bool, the default mode'
complete -c ug -s M -l file-magic -d 'Only search files matching the magic signature pattern MAGIC'
complete -c ug -s m -l min-count -l max-count -d 'Require MIN matches, stop after MAX matches when specified'
complete -c ug -s M -r -l file-magic -d 'Only search files matching the magic signature pattern MAGIC'
complete -c ug -s m -r -l min-count -l max-count -d 'Require MIN matches, stop after MAX matches when specified'
complete -c ug -l match -d 'Match all input'
complete -c ug -l max-files -d 'Restrict the number of files matched to NUM'
complete -c ug -l mmap -d 'Use memory maps to search files'
complete -c ug -s N -l neg-regexp -d 'Specify a negative PATTERN to reject pattern matches that also match PATTERN'
complete -c ug -s N -r -l neg-regexp -d 'Specify a negative PATTERN to reject pattern matches that also match PATTERN'
complete -c ug -s n -l line-number -d 'Each output line is preceded by its relative line number in the file, starting at line 1'
complete -c ug -l no-group-separator -d 'Removes the group separator line from the output for context options -A, -B and -C'
complete -c ug -l not -d 'Specifies that PATTERN should not match'
complete -c ug -s O -l file-extension -d 'Only search files whose filename extensions match the specified comma-separated list of EXTENSIONS, same as -g *.ext for each'
complete -c ug -s O -r -l file-extension -d 'Only search files whose filename extensions match the specified comma-separated list of EXTENSIONS, same as -g *.ext for each'
complete -c ug -s o -l only-matching -d 'Only the matching part of a pattern match is output'
complete -c ug -l only-line-number -d 'Only the line number of a matching line is output'
complete -c ug -l files -o '%%' -d 'Boolean file matching mode, the opposite of --lines'
Expand Down
Loading

0 comments on commit 0bdc215

Please sign in to comment.