I had to ignore multiple directories, so I tried
ag --hidden --ignore '.git' --ignore 'plugged' -g ""
But this process of narrating --ignore
each time I tried to ignore a directory felt needless. So, I tried with bash curly brace completion like in the following:
ag --hidden --ignore {.git,plugged} -g ""
But it didn't work, and rightfully so. Because the stuff inside the curly braces, after completion would look like
ag --hidden --ignore .git plugged -g ""
After browsing a little I tried:
ag --hidden --ignore={.git,plugged} -g ""
And it worked. But why using --ignore=PATTERN
yield same result as --ignore PATTERN
when the documentation (man ag) clearly states the way to be --ignore PATTERN
?
This is a known issue with ag
's command line parsing vs. its documentation. See:
In this specific case, since ag
properly reads the ignore pattern with and without the equal sign, it seems more like an undocumented feature than a short coming.