mk_dir.pl
来自「This a framework to test new ideas in tr」· PL 代码 · 共 35 行
PL
35 行
#!/usr/bin/perl -w# mkdirreadme - a very simple document-extractor for subdirs..## 04/03/08 - ineiti - imported from mk_dir_modules.pl and adjusted for radios# 04/03/17 - ineiti - no 'Description' necessary anymore to start the description...# 04/03/29 - ineiti - renamed to mk_dir.plif ( $#ARGV < 0 ){ die "Give the directory name as argument"}$dirs = `ls $ARGV[0]`;$dirs =~ s/\n/ /g;foreach $dir ( `find $dirs -type d -maxdepth 0 | grep -v CVS` ){ chomp( $dir ); if ( -e "$dir/README" ){ getDescription( $dir ); }}# Extracts the documentation from the README-filesub getDescription{ my $d = shift; my $readme = `cat $d/README`; my ($name) = ( $readme =~ /(.*)/ ); # The description comes right after the name, excluding any empty lines $readme =~ s/.*?\n.*?\n+(.*?)((\s*\n){2}.*|$)/$1/s; # Chomp trailing spaces and newlines $readme =~ s/(\s*\n)*$//g; print $name . "\n" . "=" x length( $name ) . "\n\n"; print $readme, "\n" x 4; return;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?