get_options(\%Opt);
#help() unless @ARGV;
$main::_DATA_ = undef;
+$Opt{find} = 1 if $Opt{'find-only'};
#################################################################################
#
#$_ = "nb_api '/pub/mime/ls/type,ext.php_hash' | sed \"s/^/\$(printf '\\t\\t')/\"";
#$_ = "nb_api /pub/mime/ls/type,ext.php_hash";
+#die map {">$_"} &cmd($_);
#warn &cmd($_);
@ARGV = grep {&file_readable($_)} @ARGV if @ARGV;
if (!@ARGV and !-t STDIN) {
}, @ARGV);
#exit;
@ARGV = @WANTED_FILES;
+ exit if $Opt{'find-only'};
}
#
if ($i==1) {
$cmd = $2;
push @lines, $line;
+ #die $cmd;
push @lines, map{s/^/$blank/;$_} &cmd($cmd);
} elsif ($line =~ /^\s*.{1,3}<SHELL_REPLACE/) {
=head1 OPTIONS
- -option[find|f!] Search first files containing tags from args
- -option[extension|e=s] Copy original to a new file with this value as an extension
+ -option[find-only|fo!] Search first files containing tags from args without processing
+ -option[find|f!] Search first files containing tags from args
+ -option[extension|e=s] Copy original to a new file with this value as an extension
- -option[verbose|v+] Verbose mode: increase the verbosity level.
- -option[debug+] Debug mode: increase the verbosity level.
- -option[version|V] Print version (default: $VERSION)
- -option[help|h|?] Print a brief help message and exits.
- -option[man] Print the manual page and exits.
+ -option[verbose|v+] Verbose mode: increase the verbosity level.
+ -option[debug+] Debug mode: increase the verbosity level.
+ -option[version|V] Print version (default: $VERSION)
+ -option[help|h|?] Print a brief help message and exits.
+ -option[man] Print the manual page and exits.
=cut
endfunc
+func! MeNow()
+ return $USER_INITIALS . ' ' . strftime('%d.%m.%y')
+endfunc
+
+func! CommentToggle()
+ let curr_line = getline('.')
+ let c = g:mimeComment[&filetype]
+
+ " wipe out comment
+ "let exp = '^'.substitute(c,'\d\d\.\d\d\.\d\d','........','')
+
+ " Wipe out existing comment
+ let new_line = substitute(curr_line,'^\([\t ]*\)'.c.' .. \d\d\.\d\d\.\d\d ','\1','')
+
+ if new_line == curr_line
+ " Add comment
+ let v = ''
+ let new_line = substitute(curr_line,'^\([\t ]*\)','\1'.c.' '.MeNow().' ','')
+ endif
+
+ call setline('.',new_line)
+endfunc
+
func! FileCommentToggle()
let curr_line = getline('.')
<?php
class Http {
const Status = [
-#>SHELL_REPLACE dbq db=$NB_DB t=http_status rows.fields=id,name orderby=id f=php_hash | sed "s/^/\t/"
+#>SHELL_REPLACE dbq.php /$NB_DB/http_status/ls/id,name orderby=id format=php_hash preff=$'\t'
"100" => "Continue",
"101" => "Switching Protocols",
"102" => "Processing",
<?php
class Mime {
const Types = [
-#>SHELL_REPLACE nb_api '/pub/mime/ls/type,ext.php_hash' | sed "s/^/$(printf '\t\t')/"
+#>SHELL_REPLACE nb_api "/pub/mime/ls/type,ext.php_hash?preff=%09%09"
"application/applixware" => "aw",
"application/atomcat+xml" => "atomcat",
"application/atomsvc+xml" => "atomsvc",