]> git.nbdom.net Git - nb.git/commitdiff
bin/shell-replace
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Thu, 28 May 2026 22:13:07 +0000 (00:13 +0200)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Thu, 28 May 2026 22:13:07 +0000 (00:13 +0200)
bin/shell-replace

index 52810add5b8869fe37ad65e4d02ea9e1552085cc..0fda7f41339266a704573f858ae2f66044fdb004 100755 (executable)
@@ -31,7 +31,6 @@ my $DEBUG = $main::DEBUG = 0;
 my %Opt = (
 );
 get_options(\%Opt);
-#help() unless @ARGV;
 $main::_DATA_ = undef;
 $Opt{find} = 1 if $Opt{'find-only'};
 $Opt{extension} =~ s/^\.// if $Opt{extension};
@@ -47,7 +46,7 @@ use File::Copy;
 use File::Find;
 no warnings 'File::Find';
 
-@ARGV = grep {&file_readable($_)} @ARGV if @ARGV;
+@ARGV = grep {file_readable($_)} @ARGV if @ARGV;
 if (!@ARGV and !-t STDIN) {
        die "$NAME: option `find` does not work with STDIN!\n" if $Opt{find};
        @ARGV = "-";
@@ -97,14 +96,14 @@ for $file (@ARGV) {
 
        verbose(1,"Processing $file");
 
-       my @lines = &shell_replace($hfile);
+       my @lines = shell_replace($hfile);
 
        close $hfile;
 
        if ( join('',@original) ne join('',@lines) ) {
                verbose(1,"Change detected in $file");
                verbose(2,'Lines: '.@lines.'/'.@original);
-               #&shell_replace_write($file,@lines) if !$is_stdin and !$DEBUG;
+               #shell_replace_write($file,@lines) if !$is_stdin and !$DEBUG;
 
                # Write changes
                if (!$is_stdin and !$DEBUG) {
@@ -164,13 +163,14 @@ sub file_readable {
        }
        return 1;
 }
+
 sub wanted {
        my $file = $File::Find::name;
-       &file_readable($file) or return;
+       file_readable($file) or return;
        #warn "$file ".(-r $file ? "YES" : "NO");
 
        # Dont want the myself
-       return if &myself($file);
+       return if myself($file);
 
        my $hfile;
        open($hfile,"<","$file");
@@ -249,7 +249,7 @@ sub shell_replace {
                                $cmd = $2;
                                push @lines, $line;
                                #die $cmd;
-                               push @lines, map{s/^/$blank/;$_} &cmd($cmd);
+                               push @lines, map{s/^/$blank/;$_} cmd($cmd);
 
                        } elsif ($line =~ /^\s*.{1,3}<SHELL_REPLACE/) {
                                $i = 0;
@@ -267,7 +267,7 @@ sub shell_replace {
                        $blank = $1;
                        $cmd = $2;
                        push @lines, $line;
-                       push @lines, map{ s/^/$blank/; $_ } &cmd($cmd);
+                       push @lines, map{ s/^/$blank/; $_ } cmd($cmd);
                        $line = <$hfile>;
 
                } else {