Skip to main content

HELP

Constant HELP 

Source
pub const HELP: &str = "\
trg — search inside compressed log archives (.tgz, .tar.zst, .tar.xz)

USAGE:
    trg [OPTIONS] PATTERN PATH...
    trg [OPTIONS] -e PATTERN... PATH...
    trg [OPTIONS] -T PATH...

At least one PATH is required. trg never searches the current directory by
default: a silent walk of $PWD is not a safe guess for a tool whose exit 1
is a claim that the logs are clean.

MATCHING (same meaning as ripgrep):
    -e, --regexp PAT      add a pattern; repeatable
    -i, --ignore-case     case-insensitive
    -S, --smart-case      case-insensitive unless the pattern has uppercase
    -w, --word-regexp     match whole words only
    -F, --fixed-strings   treat patterns as literals
    -v, --invert-match    show non-matching lines
    -a, --text            search members that look binary
    -m, --max-count NUM   stop after NUM matches per member
        --crlf            treat CRLF as the line terminator

OUTPUT (same meaning as ripgrep):
    -n, --line-number     show line numbers (default)
    -N, --no-line-number  hide line numbers
    -A, --after NUM       lines of trailing context
    -B, --before NUM      lines of leading context
    -C, --context NUM     lines of context on both sides
    -o, --only-matching   print only the matching part
    -c, --count           print a count per member
    -l, --files-with-matches
                          print member paths only
    -q, --quiet           print nothing; exit code only
        --json            JSON Lines output
        --color WHEN      auto | always | never (auto: only on a tty)
        --escape WHEN     show control bytes from logs and member names as
                          text (\\x1b) instead of sending them to the
                          terminal: auto | always | never (auto: on a tty,
                          per stream; piped output stays byte-exact)
                          If several output modes are given, the most
                          suppressive wins: -q, then -l, then -c, then --json.

ARCHIVES:
    -g, --glob PAT        filter MEMBERS inside archives; repeatable. Without
                          a `/` it also matches the member's file name. A
                          leading ! excludes; the last matching glob wins
        --archive-glob PAT
                          when walking a directory, search only the archives
                          matching PAT; repeatable. Without a `/` it matches
                          the file name at any depth, with one the path below
                          the directory named. Files named explicitly are
                          always searched. A leading ! excludes, as for -g.
                          Matching nothing is exit 2
    -T, --list-members    list member paths without searching. Takes no
                          PATTERN at all: every positional is a PATH, so
                          `trg -T *.tgz` lists all of them
        --archive-sep C   separator in archive:member:line (default ':')
        --no-sort         allow output in completion order

RESOURCES:
    -j, --jobs NUM        archives searched concurrently (default 1)
        --turbo           -j <ncpus> --nice 0
        --nice NUM        scheduling priority (default 10)
        --no-nice         do not lower priority
        --no-drop-cache   keep archive pages in the page cache
        --load-limit N    clamp jobs if 1-min load average exceeds N

    -h, --help            this message
    -V, --version         version

EXIT CODES:
    0  matches found, everything read
    1  no matches, everything read
    2  something went unread — never trust a 1 you did not get

NOTES (documented, and surprising the first time):
    -T lists every member, including ones a search skips as binary.
    Two directories symlinking the same file search it once (identity dedup).
    An intact archive behind a corrupt gzip trailer is a 0; truncation is
      still caught and is a 2.
    --turbo's ordered output is not bounded by the spill cap; peak RSS grows
      with the match volume held in order.
    On a broken pipe (`| head`) trg stops early and exits 0, leaving later
      archives unread.
    Compression is detected from content, never from the filename, so there is
      no -z flag. gzip, zstd and xz are recognised, each unwrapped one level, so a
      logrotate'd access.log.1.gz, .zst or .xz inside the archive is searched
      as text rather than skipped as binary.
    --inflate and --inflate-budget are accepted and ignored since 0.7.0, with
      a note on stderr: trg always streams.
";