beyondgrep / ack3

ack is a grep-like search tool optimized for source code.
https://beyondgrep.com/
Other
713 stars 66 forks source link

Make ack expand globs on Windows #295

Open xenu opened 4 years ago

xenu commented 4 years ago
C:\Users\xenu>ack foobar *.txt
ack: *.txt: No such file or directory

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 calling glob() on each argument, see Win32::Autoglob for an example.

IMHO adding wildcard expansion would significantly improve usability of ack on Windows.

petdance commented 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.

WrongBit commented 4 years ago

@petdance : "*.txt" - doesn't it remind you FILE TYPE??

WrongBit commented 4 years ago

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.

petdance commented 4 years ago

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.

n1vux commented 4 years ago

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).

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.