Skip to content

Commit

Permalink
released 3.12.6
Browse files Browse the repository at this point in the history
New option -S (--dereference-files) to follow symbolic lines only to files, not to directories, when using -r for recursive search; updated default recursive search to strictly perform -r
  • Loading branch information
genivia-inc committed Aug 6, 2023
1 parent a98b62c commit d3d2ce8
Show file tree
Hide file tree
Showing 14 changed files with 410 additions and 213 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ How to contribute
=================

Thank you for taking the time to contribute. Let's keep moving forward
together to make ugrep the best Universal grep utility on the planet.
together to make ugrep the best grep utility on the planet.

The following is a set of guidelines for contributing to ugrep.

Expand Down
66 changes: 36 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1350,7 +1350,7 @@ using ugrep query selection mode (press Enter to select lines):

<a name="recursion"/>

### Recursively list matching files with -l, -R, -r, --depth, -g, -O, and -t
### Recursively list matching files with -l, -R, -r, -S, --depth, -g, -O, and -t

-L, --files-without-match
Only the names of files not containing selected lines are written
Expand All @@ -1367,13 +1367,15 @@ using ugrep query selection mode (press Enter to select lines):
specified, outputs directories in a tree-like format.
-R, --dereference-recursive
Recursively read all files under each directory. Follow all
symbolic links to directories, unlike -r. See also option --sort.
symbolic links to files and directories, unlike -r.
-r, --recursive
Recursively read all files under each directory, following symbolic
links to files but not to directories. Note that when no FILE
links only if they are on the command line. Note that when no FILE
arguments are specified and input is read from a terminal,
recursive searches are performed as if -r is specified. See also
option --sort.
recursive searches are performed as if -r is specified.
-S, --dereference-files
When -r is specified, symbolic links to files are followed, but not
to directories. The default is not to follow symbolic links.
--depth=[MIN,][MAX], -1, -2, -3, ... -9, --10, --11, --12, ...
Restrict recursive searches from MIN to MAX directory levels deep,
where -1 (--depth=1) searches the specified path without recursing
Expand Down Expand Up @@ -1413,8 +1415,7 @@ If no FILE arguments are specified and input is read from a terminal, recursive
searches are performed as if `-r` is specified. To force reading from standard
input, specify `-` as the FILE argument.

To recursively list all non-empty files in the working directory, following
symbolic links:
To recursively list all non-empty files in the working directory:

ug -r -l ''

Expand Down Expand Up @@ -2340,10 +2341,10 @@ Line feed (`\n`) and NUL (`\0`) characters are never deleted or substituted to
ensure that fuzzy matches do not extend the pattern match beyond the number of
lines specified by the regex pattern.

Option `-U` (`--binary`) restricts fuzzy matches to ASCII and binary only with
edit distances measured in bytes. Otherwise, fuzzy pattern matching is
performed with Unicode patterns and edit distances are measured in Unicode
characters.
Option `-U` (`--ascii` or `--binary`) restricts fuzzy matches to ASCII and
binary only with edit distances measured in bytes. Otherwise, fuzzy pattern
matching is performed with Unicode patterns and edit distances are measured in
Unicode characters.

Option `--sort=best` orders files by best match. Files with at least one exact
match anywhere in the file are shown first, followed by files with approximate
Expand Down Expand Up @@ -2597,7 +2598,7 @@ meaning; any name or string that does not contain a `:` or `,` may be used.

### Searching and displaying binary files with -U, -W, and -X

-U, --binary
-U, --ascii, --binary
Disables Unicode matching for binary file matching, forcing PATTERN
to match bytes, not Unicode characters. For example, -U '\xa3'
matches byte A3 (hex) instead of the Unicode code point U+00A3
Expand Down Expand Up @@ -4397,7 +4398,13 @@ in markdown:

--index
Perform indexing-based search on files indexed with ugrep-indexer.
Note: a beta release feature.
Recursive searches are performed by skipping non-matching files.
Binary files are skipped with option -I. Note that the start-up
time to search is increased, which may be significant when complex
search patterns are specified that contain large Unicode character
classes with `*' or `+' repeats, which should be avoided. Option
-U (--ascii) improves performance. Option --stats=vm displays a
detailed indexing-based search report. This is a beta feature.

-J NUM, --jobs=NUM
Specifies the number of threads spawned to search files. By
Expand Down Expand Up @@ -4537,8 +4544,8 @@ in markdown:
pattern matching.

-p, --no-dereference
If -R or -r is specified, no symbolic links are followed, even
when they are specified on the command line.
If -R or -r is specified, do not follow symbolic links, even when
symbolic links are specified on the command line.

--pager[=COMMAND]
When output is sent to the terminal, uses COMMAND to page through
Expand Down Expand Up @@ -4573,15 +4580,14 @@ in markdown:
has been found.

-R, --dereference-recursive
Recursively read all files under each directory. Follow all
symbolic links to directories, unlike -r. See also option --sort.
Recursively read all files under each directory. Follow symbolic
links to files and directories, unlike -r.

-r, --recursive
Recursively read all files under each directory, following
symbolic links to files but not to directories. Note that when no
FILE arguments are specified and input is read from a terminal,
recursive searches are performed as if -r is specified. See also
option --sort.
symbolic links only if they are on the command line. Note that
when no FILE arguments are specified and input is read from a
terminal, recursive searches are performed as if -r is specified.

--replace=FORMAT
Replace matching patterns in the output by the specified FORMAT
Expand All @@ -4590,9 +4596,9 @@ in markdown:
outputs `%' and `%~' outputs a newline. See option --format,
`ugrep --help format' and `man ugrep' section FORMAT for details.

-S, --dereference
If -r is specified, all symbolic links are followed, like -R. The
default is not to follow symbolic links to directories.
-S, --dereference-files
When -r is specified, follow symbolic links to files, but not to
directories. The default is not to follow symbolic links.

-s, --no-messages
Silent mode: nonexistent and unreadable files are ignored, i.e.
Expand Down Expand Up @@ -4668,11 +4674,11 @@ in markdown:
options -c, -l or -L are used. This option is enabled by --pretty
when the output is sent to a terminal.

-U, --binary
Disables Unicode matching for binary file matching, forcing
PATTERN to match bytes, not Unicode characters. For example, -U
'\xa3' matches byte A3 (hex) instead of the Unicode code point
U+00A3 represented by the UTF-8 sequence C2 A3. See also option
-U, --ascii, --binary
Disables Unicode matching for ASCII and binary matching. PATTERN
matches bytes, not Unicode characters. For example, -U '\xa3'
matches byte A3 (hex) instead of the Unicode code point U+00A3
represented by the UTF-8 sequence C2 A3. See also option
--dotall.

-u, --ungroup
Expand Down Expand Up @@ -5339,7 +5345,7 @@ in markdown:



ugrep 3.12.5 August 4, 2023 UGREP(1)
ugrep 3.12.6 August 6, 2023 UGREP(1)

🔝 [Back to table of contents](#toc)

Expand Down
Binary file modified bin/win32/ugrep.exe
Binary file not shown.
Binary file modified bin/win64/ugrep.exe
Binary file not shown.
20 changes: 10 additions & 10 deletions configure
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.71 for ugrep 3.6.
# Generated by GNU Autoconf 2.71 for ugrep 3.12.
#
#
# Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation,
Expand Down Expand Up @@ -609,8 +609,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='ugrep'
PACKAGE_TARNAME='ugrep'
PACKAGE_VERSION='3.6'
PACKAGE_STRING='ugrep 3.6'
PACKAGE_VERSION='3.12'
PACKAGE_STRING='ugrep 3.12'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''

Expand Down Expand Up @@ -1349,7 +1349,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures ugrep 3.6 to adapt to many kinds of systems.
\`configure' configures ugrep 3.12 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
Expand Down Expand Up @@ -1420,7 +1420,7 @@ fi

if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of ugrep 3.6:";;
short | recursive ) echo "Configuration of ugrep 3.12:";;
esac
cat <<\_ACEOF
Expand Down Expand Up @@ -1562,7 +1562,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
ugrep configure 3.6
ugrep configure 3.12
generated by GNU Autoconf 2.71
Copyright (C) 2021 Free Software Foundation, Inc.
Expand Down Expand Up @@ -2099,7 +2099,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by ugrep $as_me 3.6, which was
It was created by ugrep $as_me 3.12, which was
generated by GNU Autoconf 2.71. Invocation command line was
$ $0$ac_configure_args_raw
Expand Down Expand Up @@ -3586,7 +3586,7 @@ fi

# Define the identity of the package.
PACKAGE='ugrep'
VERSION='3.6'
VERSION='3.12'


printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
Expand Down Expand Up @@ -9358,7 +9358,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by ugrep $as_me 3.6, which was
This file was extended by ugrep $as_me 3.12, which was
generated by GNU Autoconf 2.71. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
Expand Down Expand Up @@ -9426,7 +9426,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config='$ac_cs_config_escaped'
ac_cs_version="\\
ugrep config.status 3.6
ugrep config.status 3.12
configured by $0, generated by GNU Autoconf 2.71,
with options \\"\$ac_cs_config\\"
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AC_INIT([ugrep],[3.6])
AC_INIT([ugrep],[3.12])
AM_INIT_AUTOMAKE([foreign])
AC_CONFIG_HEADERS([config.h])
AC_COPYRIGHT([Copyright (C) 2019-2022 Robert van Engelen, Genivia Inc.])
Expand Down
35 changes: 20 additions & 15 deletions man/ugrep.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH UGREP "1" "August 04, 2023" "ugrep 3.12.5" "User Commands"
.TH UGREP "1" "August 06, 2023" "ugrep 3.12.6" "User Commands"
.SH NAME
\fBugrep\fR, \fBug\fR -- file pattern searcher
.SH SYNOPSIS
Expand Down Expand Up @@ -519,7 +519,13 @@ only. Note that \fB\-\-exclude\-fs\fR mounts take priority over
.TP
\fB\-\-index\fR
Perform indexing\-based search on files indexed with ugrep\-indexer.
Note: a beta release feature.
Recursive searches are performed by skipping non\-matching files.
Binary files are skipped with option \fB\-I\fR. Note that the start\-up
time to search is increased, which may be significant when complex
search patterns are specified that contain large Unicode character
classes with `*' or `+' repeats, which should be avoided. Option
\fB\-U\fR (\fB\-\-ascii\fR) improves performance. Option \fB\-\-stats\fR=vm displays a
detailed indexing\-based search report. This is a beta feature.
.TP
\fB\-J\fR \fINUM\fR, \fB\-\-jobs\fR=\fINUM\fR
Specifies the number of threads spawned to search files. By
Expand Down Expand Up @@ -658,8 +664,8 @@ Note that Perl pattern matching differs from the default grep POSIX
pattern matching.
.TP
\fB\-p\fR, \fB\-\-no\-dereference\fR
If \fB\-R\fR or \fB\-r\fR is specified, no symbolic links are followed, even when
they are specified on the command line.
If \fB\-R\fR or \fB\-r\fR is specified, do not follow symbolic links, even when
symbolic links are specified on the command line.
.TP
\fB\-\-pager\fR[=\fICOMMAND\fR]
When output is sent to the terminal, uses COMMAND to page through
Expand Down Expand Up @@ -693,15 +699,14 @@ Quiet mode: suppress all output. Only search a file until a match
has been found.
.TP
\fB\-R\fR, \fB\-\-dereference\-recursive\fR
Recursively read all files under each directory. Follow all
symbolic links to directories, unlike \fB\-r\fR. See also option \fB\-\-sort\fR.
Recursively read all files under each directory. Follow symbolic
links to files and directories, unlike \fB\-r\fR.
.TP
\fB\-r\fR, \fB\-\-recursive\fR
Recursively read all files under each directory, following symbolic
links to files but not to directories. Note that when no FILE
links only if they are on the command line. Note that when no FILE
arguments are specified and input is read from a terminal,
recursive searches are performed as if \fB\-r\fR is specified. See also
option \fB\-\-sort\fR.
recursive searches are performed as if \fB\-r\fR is specified.
.TP
\fB\-\-replace\fR=\fIFORMAT\fR
Replace matching patterns in the output by the specified FORMAT
Expand All @@ -710,9 +715,9 @@ with `%' fields. If \fB\-P\fR is specified, FORMAT may include `%1' to
outputs `%' and `%~' outputs a newline. See option \fB\-\-format\fR,
`ugrep \fB\-\-help\fR format' and `man ugrep' section FORMAT for details.
.TP
\fB\-S\fR, \fB\-\-dereference\fR
If \fB\-r\fR is specified, all symbolic links are followed, like \fB\-R\fR. The
default is not to follow symbolic links to directories.
\fB\-S\fR, \fB\-\-dereference\-files\fR
When \fB\-r\fR is specified, follow symbolic links to files, but not to
directories. The default is not to follow symbolic links.
.TP
\fB\-s\fR, \fB\-\-no\-messages\fR
Silent mode: nonexistent and unreadable files are ignored, i.e.
Expand Down Expand Up @@ -788,9 +793,9 @@ Output directories with matching files in a tree\-like format when
options \fB\-c\fR, \fB\-l\fR or \fB\-L\fR are used. This option is enabled by \fB\-\-pretty\fR
when the output is sent to a terminal.
.TP
\fB\-U\fR, \fB\-\-binary\fR
Disables Unicode matching for binary file matching, forcing PATTERN
to match bytes, not Unicode characters. For example, \fB\-U\fR '\\xa3'
\fB\-U\fR, \fB\-\-ascii\fR, \fB\-\-binary\fR
Disables Unicode matching for ASCII and binary matching. PATTERN
matches bytes, not Unicode characters. For example, \fB\-U\fR '\\xa3'
matches byte A3 (hex) instead of the Unicode code point U+00A3
represented by the UTF\-8 sequence C2 A3. See also option \fB\-\-dotall\fR.
.TP
Expand Down
1 change: 1 addition & 0 deletions src/flag.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ extern bool flag_cpp;
extern bool flag_csv;
extern bool flag_decompress;
extern bool flag_dereference;
extern bool flag_dereference_files;
extern bool flag_files;
extern bool flag_files_with_matches;
extern bool flag_files_without_match;
Expand Down
8 changes: 4 additions & 4 deletions src/stats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ void Stats::report(FILE *output)
{
fprintf(output, "Detected outdated or missing index files, run ugrep-indexer to re-index:\n");
if (changed > 1)
fprintf(output, " %zu files were changed after indexing and searched\n", changed);
fprintf(output, " searched %zu changed files\n", changed);
else if (changed == 1)
fprintf(output, " 1 file was changed after indexing and searched\n");
fprintf(output, " searched 1 changed file\n");
if (added > 1)
fprintf(output, " %zu new files are not indexed and searched\n", added);
fprintf(output, " searched %zu new files\n", added);
else if (added == 1)
fprintf(output, " 1 new file is not indexed and searched\n");
fprintf(output, " searched 1 new file\n");
}
}

Expand Down
Loading

0 comments on commit d3d2ce8

Please sign in to comment.