Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--files ignores first path argument #64

Closed
nickstenning opened this issue Sep 24, 2016 · 4 comments
Closed

--files ignores first path argument #64

nickstenning opened this issue Sep 24, 2016 · 4 comments

Comments

@nickstenning
Copy link
Contributor

I'm not sure whether this is a misunderstanding, a documentation bug, or an actual bug, but the --files option appears to ignore the first path argument given to it:

Steps to reproduce

Here's a shell session that shows the problem:

$ uname -mrsv
Darwin 15.6.0 Darwin Kernel Version 15.6.0: Mon Aug 29 20:21:34 PDT 2016; root:xnu-3248.60.11~1/RELEASE_X86_64 x86_64
$ rg --version
0.1.17
$ mkdir a b c
$ touch {a,b,c}/{x,y,z}
$ tree
.
├── a
│   ├── x
│   ├── y
│   └── z
├── b
│   ├── x
│   ├── y
│   └── z
└── c
    ├── x
    ├── y
    └── z

3 directories, 9 files
$ rg --files
./a/x
./a/y
./a/z
./b/x
./b/y
./b/z
./c/x
./c/y
./c/z
$ rg --files a
./a/x
./a/y
./a/z
./b/x
./b/y
./b/z
./c/x
./c/y
./c/z
$ rg --files a b
b/x
b/y
b/z
$ rg --files a b c
b/x
b/y
b/z
c/x
c/y
c/z

Is this because the first argument is the (ignored) pattern? If so, I think the docs need updating, as the man page says:

   rg [options] --files [<path> ...]
@caipre
Copy link

caipre commented Sep 24, 2016

Also very confused by this. Does rg only search the current working directory?

@BurntSushi
Copy link
Owner

The title is likely accurate.

@homeworkprod
Copy link

Thanks for reporting and fixing this, respectively!

Just stumbled upon this, trying to use ripgrep with the CtrlP plugin for Vim.

@homeworkprod
Copy link

I can confirm that the patch works for me. Thanks again!

In case somebody else is interested, this is now in my ~/.vimrc:

if executable('rg')
  let g:ctrlp_user_command = 'rg --files %s'
  let g:ctrlp_use_caching = 0
endif

amsharma91 added a commit to amsharma91/ripgrep that referenced this issue Sep 27, 2016
This is a docopt oddity, but probably not a bug. If --files is given,
then just interpret the pattern (if not empty) as the first file path.

Fixes BurntSushi#64.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants