We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ac48579 commit 01c8f69Copy full SHA for 01c8f69
5 files changed
ack
@@ -440,7 +440,12 @@ sub _compile_file_filter {
440
441
return sub {
442
if ( $opt_g ) {
443
- if ( $File::Next::name =~ /$re_match/o ) {
+ my $match = ($File::Next::name =~ /$re_match/o);
444
+ if ( $match && $re_not ) {
445
+ $match = ($File::Next::name !~ /$re_not/o);
446
+ }
447
+
448
+ if ( $match ) {
449
return 0 if $opt_v;
450
}
451
else {
dev/crank-mutex
@@ -15,10 +15,9 @@ sub invalid_combinations {
15
my @output = qw( -o --output );
16
my @fg = qw( -f -g );
17
my @case = qw( -i -I --smart-case );
18
- my @booleans = qw( --and --or --not );
19
20
return (
21
- [qw(--or)] => [qw( --and --not )],
+ [qw(--and)] => [qw( --or )],
22
[qw(-l)] => [@context, @file_lists, @pretty, @filename, @output, qw(--passthru --column --show-types)],
23
[qw(-L)] => [@context, @file_lists, @pretty, @filename, @output, qw(--passthru --column --show-types -c -v)],
24
[@output] => [@context, @file_lists, @output, qw(-c --column --show-types)],
@@ -31,7 +30,6 @@ sub invalid_combinations {
31
30
[qw(--column)] => [@file_lists],
32
[@context] => [@file_lists],
33
[qw(-f)] => [qw(-v), @case],
34
- [qw(-g)] => [@booleans],
35
[@fg] => [@fg, @pretty, qw(-x -c -u --files-from)],
36
[qw(-p)] => [@context, @file_lists, qw(--passthru -c)],
37
[qw(-v)] => [qw(--column -o --output --passthru)],
lib/App/Ack.pm
@@ -841,7 +841,7 @@ sub build_all_regexes {
841
842
my @parts;
843
844
- # AND: alpha and beta
+ # AND: alpha AND beta
845
if ( @parts = @{$opt->{and}} ) {
846
my @match_parts;
847
my @hilite_parts;
@@ -875,8 +875,9 @@ sub build_all_regexes {
875
$re_hilite = $re_match;
876
$re_scan = join( '|', @scan_parts );
877
878
879
# NOT: alpha NOT beta
- elsif ( @parts = @{$opt->{not}} ) {
880
+ if ( @parts = @{$opt->{not}} ) {
881
($re_match, $re_scan) = build_regex( $opt_regex, $opt );
882
883
lib/App/Ack/ConfigLoader.pm
@@ -933,7 +933,6 @@ sub mutex_options {
933
'with-filename' => 1,
934
},
935
and => {
936
- g => 1,
937
or => 1,
938
939
break => {
@@ -1011,7 +1010,6 @@ sub mutex_options {
1011
1010
C => 1,
1012
H => 1,
1013
L => 1,
1014
- and => 1,
1015
break => 1,
1016
c => 1,
1017
column => 1,
@@ -1024,9 +1022,7 @@ sub mutex_options {
1024
1022
l => 1,
1025
1023
m => 1,
1026
match => 1,
1027
- not => 1,
1028
o => 1,
1029
- or => 1,
1030
output => 1,
1031
p => 1,
1032
passthru => 1,
@@ -1093,10 +1089,6 @@ sub mutex_options {
1093
1089
1094
1090
1095
1091
1096
- not => {
1097
1098
1099
- },
1100
1092
o => {
1101
A => 1,
1102
B => 1,
@@ -1116,8 +1108,6 @@ sub mutex_options {
1116
1108
1117
1109
or => {
1118
1110
and => 1,
1119
1120
1121
1111
1122
1112
output => {
1123
1113
t/ack-g.yaml
@@ -119,3 +119,27 @@ stdout: |
119
t/text/numbered-text.txt
120
t/text/ozymandias.txt
121
t/text/raven.txt
122
123
+---
124
+name: -g and --and
125
+args: -g foo --and test t/
126
+stdout:
127
+ t/swamp/foo_test.py
128
+ t/swamp/test_foo.py
129
130
131
+name: -g and --not
132
+args: -g foo --not test t/
133
134
+ t/etc/shebang.foobar.xxx
135
+ t/swamp/file.foo
136
137
138
+name: -g and --or
139
+args: -g foo --or test t/
140
141
142
+ t/swamp/file.bar
143
144
145
0 commit comments