Ripgrep: rg --type-add not working

Created on 28 Sep 2016  路  10Comments  路  Source: BurntSushi/ripgrep

Even tried to copy your example (ie rg --type-add 'foo:*.{foo,foobar}'), not adding the type to type-list.

Mac - El Capitain 10.11.6

Most helpful comment

--type-add is probably most useful in an alias.

All 10 comments

Could you please provide the entire command you're running, its output and the output you expected? Thanks.

typing rg --type-add 'vue:*.vue' is returning Invalid argument

See picture attached
image

That looks like expected behavior to me. Check out the docs for --type-add:

    --type-add ARG ...
        Add a new glob for a particular file type. Only one glob can be added
        at a time. Multiple type-add flags can be provided. Unless type-clear
        is used, globs are added to any existing globs inside of ripgrep. Note
        that this must be passed to every invocation of rg.

        Example: `--type-add html:*.html`

So you need to do rg --type-add 'vue:*.{vue}' -tvue PATTERN.

Perhaps we need more concrete examples. I think that's #76.

Sorry, but is not exactly what I understand from the "tour"

image

Reading that I would suppose that typing rg --type-add 'foo:*.{foo,foobar}' would return a message like "New type added" and that rg --type-list would list that.

You're right. Thank you for catching that. The tour is sadly wrong. Fixing now.

All set. Thanks!

I'm sorry, don't want to seem pedant, is what I described before as "expected behaviour" for rg --type-add ... actually the behaviour?

Because this is what I get following the new instructions:
image
this is definitely not what I'm expecting from this setting

I put this note in the README:

rg won't persist your type settings

Let me be very clear: --type-add must always be present. rg has no config file, it does not persist any of the options. If you want to configure it to always be present, use an alias. e.g., alias rg="rg --type-add 'foo:*.{foo,foobar}'.

(We may grow a config file or something at some point.)

Ok so why should I write such a long line when I can do this?
rg bar -g "*.{foo,foobar}"

--type-add is probably most useful in an alias.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kenorb picture kenorb  路  3Comments

timotheecour picture timotheecour  路  3Comments

fcantournet picture fcantournet  路  3Comments

Limeth picture Limeth  路  3Comments

Offpics picture Offpics  路  3Comments