Skip to content

"was provided more than once" when combining RIPGREP_CONFIG_PATH with command-lines using condensed short option syntax #1701

@ssokolow

Description

@ssokolow

What version of ripgrep are you using?

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

How did you install ripgrep?

RUSTFLAGS="-C target-cpu=native" cargo +nightly install ripgrep --features 'simd-accel'

What operating system are you using ripgrep on?

$ lsb_release -a                                                                             
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.7 LTS
Release:        16.04
Codename:       xenial

Describe your bug.

ripgrep exits with the following error...

error: The argument '--pretty' was provided more than once, but cannot be used multiple times

...if -p or --pretty is in the configuration file and condensed short option syntax is used on the command line.

What are the steps to reproduce the behavior?

  1. Set up RIPGREP_CONFIG_PATH and a configuration file containing -p or --pretty
  2. Run ripgrep with -p -z or --pretty -z at the command line.
  3. Notice that it works as expected, as it should for use in scripts.
  4. Run ripgrep with -p -z -p at the command line
  5. Notice that it works in an alias-compatible way as it should.
  6. Run ripgrep with -pz at the command line.
  7. Get an error message.

What is the actual behavior?

$ rg -pz foo /usr/share/doc 
error: The argument '--pretty' was provided more than once, but cannot be used multiple times

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?

It shouldn't matter what form it takes.

What do you think ripgrep should have done?

-pz should behave identically to -p -z.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA bug.rollupA PR that has been merged with many others in a rollup.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions