Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a -X that acts like -x but obeys the --type filters #368

Open
petdance opened this issue Mar 26, 2023 · 4 comments
Open

Add a -X that acts like -x but obeys the --type filters #368

petdance opened this issue Mar 26, 2023 · 4 comments
Labels

Comments

@petdance
Copy link
Collaborator

ack -x ignores type filters. This is surprising to some users, and there have been repeated calls for -x to respect the --type filters.

It's too late to change the behavior of -x, but perhaps we add another flag, maybe -X, that obeys the type filters.

Let's discuss.

@jakebman
Copy link

I might ask to consider having the flag be independent of -x - this behavior is also confusing on the command line.

(Also, this way it can be embeded in ackrc)

@petdance
Copy link
Collaborator Author

What does "independent of -x" mean? Which behavior is also confusing on the command line? Which way it can be embedded in ackrc?

@jakebman
Copy link

Independent of -x: -x is just a specialization of --files-from, right? It feels weird to have type filtering apply only to stdin, and not any other file you could read your starting set from.
I'd really like it if it could be applied to any other --files-from, and additionally to the starting set specified on the command line (otherwise the "consistent with *.pl --noperl" consistency is broken)

Behavior on the command line: It's confusing that --noperl doesn't exclude .pl files from a starting set. This behavior is equally confusing from the command line and -x. This behavior is surprising/confusing/non-DWIM in both contexts, and I'm asking for a fix to it to be considered to be able to resolved in both contexts.

Specify in ackrc: Even though we can't break existing scripts, I personally want this feature to be the default ack behavior, and that's what ackrc is for: to have personal default settings. Having this as an independent flag I can tuck into my ackrc basically gives me that power. I wouldn't be able to do that with -X.

None of this is an argument against -X as a new flag. I'm just asking to consider making the behavior broader (to cover --files-from, and the CLI starting set), and allow -X to mean "-x, but respecting type filters" in the same way that --some-new-flag-name would cause type filters to be respected in non-stdin --files-from, or on the CLI.

@n1vux
Copy link
Contributor

n1vux commented May 4, 2023

Ability to use ack type filters in xargs mode is some setting i'd use. Our filters are more expressive than e.g. finds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants