ack2 icon indicating copy to clipboard operation
ack2 copied to clipboard

Add support for negation of -k --known-types options

Open packy opened this issue 11 years ago • 5 comments

Implementation of feature request in issue https://github.com/petdance/ack2/issues/293.

packy avatar Apr 15 '14 06:04 packy

Awesome work @packy! This looks mostly good to me, only a few issues:

  • Could you rebase your work on top of current dev and get rid of the merge commit?
  • I think we've discusssed this before, but is --no-known-types the best name for the switch? Maybe --not-only-known-types, but that might be needlessly verbose...
  • In your patch you blow away $opt->{filters}; have you seen any issues combining --no-known-types with --type=perl, --notype=perl, and such? Combining with --type=perl seems silly, but --notype=perl might make some sense.

hoelzro avatar Apr 15 '14 13:04 hoelzro

I think it needs to follow the convention of --no-xxxx and be --no-known-types.

petdance avatar Apr 15 '14 13:04 petdance

It was rebased on top of current dev, but I figured out how to get rid of the merge commit.

And I took the name --no-known-types from Andy's suggestion in issue https://github.com/petdance/ack2/issues/293.

I hadn't tried combining it with --type=noperl, so I just did:

  • ack -K --type=noperl foo searches for 'foo' in all files except perl files
  • ack --type=noperl -K foo searches for 'foo' in all files

Which is pretty much what I'd expect it to do: negate all type filtering that had been specified up to that point.

Remember, this is mostly a way for users to turn off a --known-types that was set in their .ackrc on a case-by-case basis.

packy avatar Apr 15 '14 18:04 packy

@packy Right, I just wanted to make sure that the behavior followed expectations. =) Everything looks good to me; should I merge @petdance?

hoelzro avatar Apr 15 '14 19:04 hoelzro

On Apr 15, 2014, at 2:02 PM, Rob Hoelz [email protected] wrote:

@packy Right, I just wanted to make sure that the behavior followed expectations. =) Everything looks good to me; should I merge @petdance?

I haven't even looked at it yet. See comment from earlier this morning.

petdance avatar Apr 15 '14 19:04 petdance