Skip to content

Regexps in configuration file are ignored if no other regexp is present in the command line #1730

@cyrus-and

Description

@cyrus-and

What version of ripgrep are you using?

ripgrep 12.1.1
-SIMD -AVX (compiled)
+SIMD +AVX (runtime)

How did you install ripgrep?

brew install ripgrep

What operating system are you using ripgrep on?

macOS 11.0.1

Describe your bug.

If regexps (--regexp) are exclusively specified in the configuration file, then they are ignored.

What are the steps to reproduce the behavior?

$ cat /tmp/.ripgreprc
--regexp
foo
$ echo 'xxx foo xxx' | RIPGREP_CONFIG_PATH=/tmp/.ripgreprc rg

What is the actual behavior?

$ echo 'xxx foo xxx' | RIPGREP_CONFIG_PATH=/tmp/.ripgreprc rg --debug
error: The following required arguments were not provided:
    <PATTERN>

USAGE:

    rg [OPTIONS] PATTERN [PATH ...]
    rg [OPTIONS] [-e PATTERN ...] [-f PATTERNFILE ...] [PATH ...]
    rg [OPTIONS] --files [PATH ...]
    rg [OPTIONS] --type-list
    command | rg [OPTIONS] PATTERN

For more information try --help

What is the expected behavior?

xxx foo xxx

(With foo being highlighted.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    docAn issue with or an improvement to documentation.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions