Ripgrep: Print glob text with glob error message

Created on 11 Apr 2017  路  2Comments  路  Source: BurntSushi/ripgrep

When I have an invalid glob:

$ rg -g "foo" -g "bar" -g "**.txt" foobar
invalid use of **; must be one path component

$ rg -g "foo" -g "bar" -g "{{}}" foobar
nested alternate groups are not allowed

There is an error printed, and the search doesn't continue, but it may not be obvious which glob is causing the issue. This comes up in https://github.com/Microsoft/vscode/issues/24050 but I imagine it may be useful for command line users to have a message like

Invalid glob "{{}}", nested alternate groups are not allowed

enhancement

Most helpful comment

OK, I think this should be fixed. Here is the new output:

$ rg -g "foo" -g "bar" -g "**.txt" foobar
error parsing glob '**.txt': invalid use of **; must be one path component
$ rg -g "foo" -g "bar" -g "{{}}" foobar
error parsing glob '{{}}': nested alternate groups are not allowed

All 2 comments

Fully agreed that the error message should be improved here. If it's just a matter of printing the invalid glob, that should hopefully be pretty easy to do. I'll see what I can do about this before the next release.

OK, I think this should be fixed. Here is the new output:

$ rg -g "foo" -g "bar" -g "**.txt" foobar
error parsing glob '**.txt': invalid use of **; must be one path component
$ rg -g "foo" -g "bar" -g "{{}}" foobar
error parsing glob '{{}}': nested alternate groups are not allowed
Was this page helpful?
0 / 5 - 0 ratings

Related issues

crumblingstatue picture crumblingstatue  路  3Comments

daxim picture daxim  路  3Comments

danpintara picture danpintara  路  3Comments

lexicalunit picture lexicalunit  路  3Comments

kenorb picture kenorb  路  3Comments