Open levsa opened 9 years ago
I would actually like this as well. For instance, I need to tell the difference between "jsx" and "js" but right now you have to use --js which finds both js and jsx files.
I actually came here looking to find documentation on this, hoping it was a feature already. I guess not, as of yet :)
Can configurate now? I want to find "aml" file,but there is not this file type,can i configurate it?
This seems to be a duplicate of #392 no?
Yep - indeed a duplicate of #392 but this one seems more popular, so I'll add my +1 here. :smiley:
but how to add new file type fo ag ? i can not the above answer,can you help me ?
@hanyimin that's not currently supported hence this issue and #392, you can't add custom file types to ag in the way you do with ack. So you either use the -G
, --include
and --exclude
flags explicitly (maybe with aliases e.g. alias agjs=ag --include='*.js'
or you use something else or you add support for it and create a PR.
@xmo-odoo thanks, I think I can use the alias method ,thanks !
+1, but --include is also nice!
--include ...
doesn't work in my version, when did it appear?
I'd like to add support for restructuredText (.rst) but so far only "*.rst" on the command-line works.
The inability the define new file types in file search tooling, and therefore requiring a parallel but different set of aliases is definitely sub-optimal.
As an example with ack, one of the almost 100 patterns I have is this:
--type-add=deb-maint:is:preinst,postinst,prerm,postrm
and sure, I could add an alias for that, but now I have to remember an alias for util 'a' and a file type name for tool 'b'. This doubles the amount of extraneous crap I need to keep in my ever shrinking head.
If ag could be configured to use the same mappings, even if non-DRY on the config, the ability to use either utility and not have to remember 2 completely different set of file selection mnemonics would be big help.
bedge: +1
+1 I'm also running into a use case for this. Need to filter by handlerbars (.hbs) files.
Also need handlebars, since Ember relies heavily on it.
I would also like to have this feature, we're using in-house file extensions in our project.
Level 0: same feature as Ack
Level 1: handle extensions including a .
(e.g. .generated.cs
)
Level 2: handle glob/pcre patterns in the extensions (e.g. .log\..*
)
+1
+1
Even worse; how is there not a built-in type for .txt
files?
$ ag --version
ag version 2.1.0
$ ag --list-file-types | grep 'txt'
.mas .mhtml .mpl .mtxt
Argh, I was really hoping this feature would've been added by now. +1
I am shocked that this feature is missing!!
It will be a great feature to have!!
I switched to https://github.com/BurntSushi/ripgrep for this reason:
$ cat ~/.ripgreprc
--type-add
tpl:*.tpl
$ grep ripgrep ~/.zshrc
export RIPGREP_CONFIG_PATH=$HOME/.ripgreprc
$ rg searchMe -ttpl # finds the string 'searchMe' in files with the extension 'tpl'
$ rg searchMe -Ttpl # finds the string 'searchMe' in files with an extension not equal to 'tpl'
It would be nice with a configuration file where one can configure own file types, similar to what ack has.