App-Bin4TSV
view release on metacpan or search on metacpan
scripts/dirhier view on Meta::CPAN
$_[0] ->[ $depth ] = "inf" if @dirs ;
return
}; # $o{m} ã§æå®ãããé層ããã¯æ·±ãã¯è¡ããã¨ã¯ãªãã
for ( @dirs ) {
my $dir1 = getcwd ;
print STDERR "\r" . (' 'x100), CYAN "\r", substr( "$dir1 $_", 0,100) ."\r" if $o{'!'} ;
chdir ( $_ ) and core $_[0] , $depth ; # <- chdir ãæåããã true
chdir ($dir1) or die "Cannot return to where it exists.\n" ; # <-- - ãããç´åã«ãããã£ã¬ã¯ããªã«æ»ããªãå ´åãã©ããã??
}
}
my $outsep = $o{'_'} ? " " : "\t" ;
my @nondir = grep { ! -d $_ } @ARGV ;
print STDERR ( CYAN '* Non-directories: [ ' . RESET join (' ', @nondir ) . CYAN " ]". RESET "\n" ) if @nondir ;
@ARGV = grep { -d $_ } @ARGV ;
$L = max 0, map { length } @ARGV ;
our @nomARGV = map { substr ' ' x $L . $_ , -$L } @ARGV ; #<--
for( @ARGV ) { # ^ãã®ã«ã¼ãã¯ä¸ãããããã¹ã«ã¤ãã¦å復ã
$fnbd = undef ; # fileNumByDepth ;
print shift @nomARGV , "\t" if ! $o{'!'} ; # <--
chdir ($_) or next ; #print "-1\n" and next ;
core $fnbd , 0 ;
do { print STDERR (' 'x100) , "\r" ; print shift @nomARGV , "\t" } if $o{'!'} ;
@{ $fnbd } = do { my $n=0; map {do { $n++ ; CYAN ("$n:") . RESET ("$_") } } @{ $fnbd } } if $o{n} ;
print join ( $outsep , @{ $fnbd } ) , "\n" ;
chdir ($dir0) or print STDERR BRIGHT_RED "Cannot return to the original directory.\n" ;
}
}
sub Chdir ( $ ) { no warnings ; chdir($_) or do { print STDERR BRIGHT_RED " 'Access_fail: $_' \n"; 0} ; use warnings }
## ãã«ãã®æ±ã
sub VERSION_MESSAGE {}
sub HELP_MESSAGE {
use FindBin qw[ $Script ] ;
$ARGV[1] //= '' ;
open my $FH , '<' , $0 ;
while(<$FH>){
s/\$0/$Script/g ;
print $_ if s/^=head1// .. s/^=cut// and $ARGV[1] =~ /^o(p(t(i(o(ns?)?)?)?)?)?$/i ? m/^\s+\-/ : 1;
}
close $FH ;
exit 0 ;
}
=encoding utf8
=head1
$0 directory [directory]..
弿°ã§æå®ããããã£ã¬ã¯ããªãã¨ã«ãããç´ä¸ã®ãã¡ã¤ã«ã®æ°ã
2段éä¸ã®ãã¡ã¤ã«ã®æ°ã3段éã®ä¸ã®ãã¡ã¤ã«ã®æ°ã..ãæå®ãããä»»æã®æ°ä¸ã£ã段éã®
ãã£ã¬ã¯ããªã«ãããã¡ã¤ã«ã®æ°ãåããå®ã表示ããã
(夿°ã®ãã¼ã¿ãã¡ã¤ã«ããããUnix/Linuxã® ls ã³ãã³ãã§ããã¡ã¤ã«ä¸è¦§ã®åå¾ã«
æéããããç¶æ³ããããã¯ãtree ã³ãã³ããããç°¡æ½ãªæ
å ±ãæ¬²ããæã«å½¹ã«ç«ã¤ã)
ãªãã·ã§ã³ :
-b : åæ·±ãã®ãã¡ã¤ã«ã®ãã¤ããµã¤ãºã®åè¨ãä¸ããã(Byte sum)
-d : ãã£ã¬ã¯ããªã®åæ°ã®ã¿æ°ããã(Directory number is counted.)
-l : ã·ã³ããªãã¯ãªã³ã¯ããã©ãã(ç¡éåç
§ãå¼ãèµ·ããå¾ãã®ã§ãè¦æ³¨æã) (symblic Links are traced.)
-m num : æãæ½ãæ·±ããæå®ãããæªæå®ãªãã6ã (the Maximum depth)
-n : æ·±ãã ã³ãã³:ã®åã«è¡¨ç¤ºããã(explicitly shows the depth Number with :)
-q : çè²ãããªãã (no coloring. visually Quiet.)
-M : (æã大ããªãµã¤ãºã®ã¿ãè¨é²; æã大ããªæ°ã®ãã¡ã¤ã«ãæã¤ãã£ã¬ã¯ããªãã©ãã«ããããæ¢ãã)
-. : ãã¡ã¤ã«åã ããªãªãã§å§ã¾ããã㪠.* ã«åè´ããç©ãæ¢ç´¢å¯¾è±¡ã¨ããããã ãã . 㨠..ãã¯é¤ãã(The hidden files whose name begin with "." are also counted.)
-_ : ã¿ãæåã®ä»£ããã«ç©ºç½æåã²ã¨ã¤ã¨ããã(Space character is used instead of tab character in the output.)
-! : ã©ã®ãã£ã¬ã¯ããªãè¦ã¦ãããããªã¢ã«ã¿ã¤ã ã«STDERR ã«åºåããã(<- å®é¨çãªæ©è½)
--help : ãã® $0 ã®ãã«ãã¡ãã»ã¼ã¸ãåºãã perldoc -t $0 | cat ã§ãã»ã¼åãã
--help opt : ãªãã·ã§ã³ã®ã¿ã®ãã«ããåºããopt以å¤ã§ã options ã¨å
é ã1æå以ä¸ä¸è´ããã°è¯ãã
éçºã¡ã¢ :
* perl -t ã¾ã㯠perl -T ã«ãã chdir颿°ã®ç®æã§è¦å/ã¨ã©ã¼ãåºãªãããã«ããã«ã¯ãå¥ã®ã³ã¼ãã£ã³ã°ãå¿
è¦ã§ãããã
* éä¸ã§åºç¾ãããã£ã¬ã¯ããªåæ¯ã«ããã®ä¸ã«ä½åã®ãã¡ã¤ã«ãå«ã¾ãã¦ãããã表示ããããã«ãããã
=cut
( run in 0.626 second using v1.01-cache-2.11-cpan-39bf76dae61 )