Open xenu opened 4 years ago
Interesting. Fifteen years of ack and nobody's told me that. Hmm.
Mind you, ack is designed so that you rarely specify file names, and specify file types instead.
@petdance : "*.txt" - doesn't it remind you FILE TYPE??
Despite amount of "likes" :) I highly recommend to implement such feature. Most typical task is "find me substring in these file types recursively from current dir". I also failed when tried to specify file type thru wildcards and most Windows developers will fail too.
Note that my comment "Interesting. Fifteen years of ack and nobody's told me that." isn't discrediting the comment. I'm just surprised, literally, that it hasn't come up before.
I'm not surprised we hadn't heard this. Even I hadn't noticed that we didn't have Globbing for Windows, and I did formerly use ack on Windows some (on my last windows laptop at home, years ago; and at work before my desktop and day-job moved to Texas without me).
Many of Ack's users on Windows will have installed BASH and PERL in one package (MKS-TK or CygWin) and will get glob expansion on commandline in BASH, and are used to commands that expect the globbing to be in BASH, and so not complain, it's normal.
Ack users, even those in CMD.exe, will usually migrate to using --txt
working recursively rather than *.txt
except for the rare case that they really really don't want recursion and only want files right here. If *.txt
doesn't work, but --txt
does, they'll just switch.
HOWEVER.
(I don't see much downside to globbing under CygWin or on other OS if a "'.txt'" is over quoted. Yeah it's legal to create a file called '.txt' on posix but not a good idea!)
So this would be a good thing to add. Would need new .t files matching our existing --txt
tests with "*.txt"
on Windows. We can probably do initial testing on POSIX ... just with extra quoting.
Windows shells (both
cmd.exe
and powershell) don't expand globs, applications have to do it on their own. In Perl, it's typically accomplished by callingglob()
on each argument, see Win32::Autoglob for an example.IMHO adding wildcard expansion would significantly improve usability of ack on Windows.