Skip to content

Commit

Permalink
Added version numbers ot the shebang detection
Browse files Browse the repository at this point in the history
  • Loading branch information
petdance committed Sep 18, 2011
1 parent e219b2d commit 399ab9a
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Ack.pm
Expand Up @@ -539,7 +539,7 @@ sub filetypes {
close $fh;

if ( $header =~ /^#!/ ) {
return ($1,TEXT) if $header =~ /\b(ruby|lua|p(?:erl|hp|ython))\d*\b/;
return ($1,TEXT) if $header =~ /\b(ruby|lua|p(?:erl|hp|ython))-?(\d[\d.]*)?\b/;
return ('shell',TEXT) if $header =~ /\b(?:ba|t?c|k|z)?sh\b/;
}
else {
Expand Down
6 changes: 6 additions & 0 deletions Changes
Expand Up @@ -9,6 +9,12 @@ NEXT

Added .pm6 as a --perl extension.

Lua can now get detected from the shebang line. Thanks, Matthew Wild.

Added support for version numbers in executables in shebang
detection. Now if your Perl program's shebang refers to
/usr/local/bin/perl-5.14.1, ack will find it.


1.94 Mon Nov 15 22:38:48 CST 2010

Expand Down
3 changes: 2 additions & 1 deletion ack
Expand Up @@ -908,6 +908,7 @@ L<http://github.com/petdance/ack>
How appropriate to have I<ack>nowledgements!
Thanks to everyone who has contributed to ack in any way, including
Matthew Wild,
Scott Kyle,
Nick Hooey,
Bo Borgerson,
Expand Down Expand Up @@ -1623,7 +1624,7 @@ sub filetypes {
close $fh;

if ( $header =~ /^#!/ ) {
return ($1,TEXT) if $header =~ /\b(ruby|p(?:erl|hp|ython))\b/;
return ($1,TEXT) if $header =~ /\b(ruby|lua|p(?:erl|hp|ython))-?(\d[\d.]*)?\b/;
return ('shell',TEXT) if $header =~ /\b(?:ba|t?c|k|z)?sh\b/;
}
else {
Expand Down
1 change: 1 addition & 0 deletions ack-base
Expand Up @@ -900,6 +900,7 @@ L<http://github.com/petdance/ack>
How appropriate to have I<ack>nowledgements!
Thanks to everyone who has contributed to ack in any way, including
Matthew Wild,
Scott Kyle,
Nick Hooey,
Bo Borgerson,
Expand Down
2 changes: 1 addition & 1 deletion t/swamp/perl-without-extension
@@ -1,4 +1,4 @@
#!/usr/bin/perl -w
#!/usr/bin/perl-5.14.1 -w

use strict;
use warnings;
Expand Down

0 comments on commit 399ab9a

Please sign in to comment.