Skip to content

Commit

Permalink
Added the --bar option
Browse files Browse the repository at this point in the history
  • Loading branch information
petdance committed Apr 26, 2012
1 parent 8453517 commit f0a1268
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 2 deletions.
49 changes: 49 additions & 0 deletions Ack.pm
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,54 @@ sub _thpppt {
exit 0;
}

sub _bar {
my $x;
$x = <<'_BAR';
6?!I'7!I"?%+!
3~!I#7#I"7#I!?!+!="+"="+!:!
2?#I!7!I!?#I!7!I"+"=%+"=#
1?"+!?*+!=#~"=!+#?"="+!
0?"+!?"I"?&+!="~!=!~"=!+%="+"
/I!+!?)+!?!+!=$~!=!~!="+!="+"?!="?!
.?%I"?%+%='?!=#~$="
,,!?%I"?(+$=$~!=#:"~$:!~!
,I!?!I!?"I"?!+#?"+!?!+#="~$:!~!:!~!:!,!:!,":#~!
+I!?&+!="+!?#+$=!~":!~!:!~!:!,!:#,!:!,%:"
*+!I!?!+$=!+!=!+!?$+#=!~":!~":#,$:",#:!,!:!
*I!?"+!?!+!=$+!?#+#=#~":$,!:",!:!,&:"
)I!?$=!~!=#+"?!+!=!+!=!~!="~!:!~":!,'.!,%:!~!
(=!?"+!?!=!~$?"+!?!+!=#~"=",!="~$,$.",#.!:!=!
(I"+"="~"=!+&=!~"=!~!,!~!+!=!?!+!?!=!I!?!+"=!.",!.!,":!
%I$?!+!?!=%+!~!+#~!=!~#:#=!~!+!~!=#:!,%.!,!.!:"
$I!?!=!?!I!+!?"+!=!~!=!~!?!I!?!=!+!=!~#:",!~"=!~!:"~!=!:",&:" '-/
$?!+!I!?"+"=!+"~!,!:"+#~#:#,"=!~"=!,!~!,!.",!:".!:! */! !I!t!'!s! !a! !g!r!e!p!!! !/!
$+"=!+!?!+"~!=!:!~!:"I!+!,!~!=!:!~!,!:!,$:!~".&:"~!,# (-/
%~!=!~!=!:!.!+"~!:!,!.!,!~!=!:$.!,":!,!.!:!~!,!:!=!.#="~!,!:" ./!
%=!~!?!+"?"+!=!~",!.!:!?!~!.!:!,!:!,#.!,!:","~!:!=!~!=!:",!~! ./!
%+"~":!~!=#~!:!~!,!.!~!:",!~!=!~!.!:!,!.",!:!,":!=":!.!,!:!7! -/!
%~",!:".#:!=!:!,!:"+!:!~!:!.!,!~!,!.#,!.!,$:"~!,":"~!=! */!
&=!~!=#+!=!~",!.!:",#:#,!.",+:!,!.",!=!+!?!
&~!=!~!=!~!:"~#:",!.!,#~!:!.!+!,!.",$.",$.#,!+!I!?!
&~!="~!:!~":!~",!~!=!~":!,!:!~!,!:!,&.$,#."+!?!I!?!I!
&~!=!~!=!+!,!:!~!:!=!,!:!~&:$,!.!,".!,".!,#."~!+!?$I!
&~!=!~!="~!=!:!~":!,!~%:#,!:",!.!,#.",#I!7"I!?!+!?"I"
&+!I!7!:#~"=!~!:!,!:"~$.!=!.!,!~!,$.#,!~!7!I#?!+!?"I"7!
%7#?!+!~!:!=!~!=!~":!,!:"~":#.!,)7#I"?"I!7&
%7#I!=":!=!~!:"~$:"~!:#,!:!,!:!~!:#,!7#I!?#7)
$7$+!,!~!=#~!:!~!:!~$:#,!.!~!:!=!,":!7#I"?#7+=!?!
$7#I!~!,!~#=!~!:"~!:!,!:!,#:!=!~",":!7$I!?#I!7*+!=!+"
"I!7$I!,":!,!.!=":$,!:!,$:$7$I!+!?"I!7+?"I!7!I!7!,!
!,!7%I!:",!."~":!,&.!,!:!~!I!7$I!+!?"I!7,?!I!7',!
!7(,!.#~":!,%.!,!7%I!7!?#I"7,+!?!7*
7+:!,!~#,"=!7'I!?#I"7/+!7+
77I!+!7!?!7!I"71+!7,
_BAR

$x =~ s/(.)(.)/$1x(ord($2)-32)/eg;
App::Ack::print( $x );
exit 0;
}

sub _key {
my $str = lc shift;
$str =~ s/[^a-z]//g;
Expand Down Expand Up @@ -825,6 +873,7 @@ Miscellaneous:
--man Man page
--version Display version & copyright
--thpppt Bill the Cat
--bar The warning admiral
Exit status is 0 if match, 1 if no match.
Expand Down
3 changes: 3 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
History file for ack. http://betterthangrep.com/

NEXT
[ENHANCEMENTS]
Add the ack --bar option to warn for traps.

[FILE TYPE UPDATES]
Added .psgi to --perl.

Expand Down
56 changes: 55 additions & 1 deletion ack
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ MAIN: {
for ( @ARGV ) {
last if ( $_ eq '--' );

# Priorities! Get the --thpppt checking out of the way.
# Priorities! Get the --thpppt and --bar checking out of the way.
/^--th[pt]+t+$/ && App::Ack::_thpppt($_);
/^--bar$/ && App::Ack::_bar();

# See if we want to ignore the environment. (Don't tell Al Gore.)
if ( /^--(no)?env$/ ) {
Expand Down Expand Up @@ -441,6 +442,10 @@ Display the all-important Bill The Cat logo. Note that the exact
spelling of B<--thpppppt> is not important. It's checked against
a regular expression.
=item B<--bar>
Check with the admiral for traps.
=item B<--type=TYPE>, B<--type=noTYPE>
Specify the types of files to include or exclude from a search.
Expand Down Expand Up @@ -1728,6 +1733,54 @@ sub _thpppt {
exit 0;
}

sub _bar {
my $x;
$x = <<'_BAR';
6?!I'7!I"?%+!
3~!I#7#I"7#I!?!+!="+"="+!:!
2?#I!7!I!?#I!7!I"+"=%+"=#
1?"+!?*+!=#~"=!+#?"="+!
0?"+!?"I"?&+!="~!=!~"=!+%="+"
/I!+!?)+!?!+!=$~!=!~!="+!="+"?!="?!
.?%I"?%+%='?!=#~$="
,,!?%I"?(+$=$~!=#:"~$:!~!
,I!?!I!?"I"?!+#?"+!?!+#="~$:!~!:!~!:!,!:!,":#~!
+I!?&+!="+!?#+$=!~":!~!:!~!:!,!:#,!:!,%:"
*+!I!?!+$=!+!=!+!?$+#=!~":!~":#,$:",#:!,!:!
*I!?"+!?!+!=$+!?#+#=#~":$,!:",!:!,&:"
)I!?$=!~!=#+"?!+!=!+!=!~!="~!:!~":!,'.!,%:!~!
(=!?"+!?!=!~$?"+!?!+!=#~"=",!="~$,$.",#.!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
"I!7$I!,":!,!.!=":$,!:!,$:$7$I!+!?"I!7+?"I!7!I!7!,!
!,!7%I!:",!."~":!,&.!,!:!~!I!7$I!+!?"I!7,?!I!7',!
!7(,!.#~":!,%.!,!7%I!7!?#I"7,+!?!7*
7+:!,!~#,"=!7'I!?#I"7/+!7+
77I!+!7!?!7!I"71+!7,
_BAR

$x =~ s/(.)(.)/$1x(ord($2)-32)/eg;
App::Ack::print( $x );
exit 0;
}

sub _key {
my $str = lc shift;
$str =~ s/[^a-z]//g;
Expand Down Expand Up @@ -1867,6 +1920,7 @@ Miscellaneous:
--man Man page
--version Display version & copyright
--thpppt Bill the Cat
--bar The warning admiral
Exit status is 0 if match, 1 if no match.
Expand Down
7 changes: 6 additions & 1 deletion ack-base
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ MAIN: {
for ( @ARGV ) {
last if ( $_ eq '--' );

# Priorities! Get the --thpppt checking out of the way.
# Priorities! Get the --thpppt and --bar checking out of the way.
/^--th[pt]+t+$/ && App::Ack::_thpppt($_);
/^--bar$/ && App::Ack::_bar();

# See if we want to ignore the environment. (Don't tell Al Gore.)
if ( /^--(no)?env$/ ) {
Expand Down Expand Up @@ -433,6 +434,10 @@ Display the all-important Bill The Cat logo. Note that the exact
spelling of B<--thpppppt> is not important. It's checked against
a regular expression.
=item B<--bar>
Check with the admiral for traps.
=item B<--type=TYPE>, B<--type=noTYPE>
Specify the types of files to include or exclude from a search.
Expand Down

0 comments on commit f0a1268

Please sign in to comment.