]> git.nbdom.net Git - nb.git/commitdiff
fix shell_replace issue
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Wed, 14 Dec 2022 13:51:19 +0000 (14:51 +0100)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Wed, 14 Dec 2022 13:51:19 +0000 (14:51 +0100)
bin/shell-replace
etc/profile.d/nb.sh
etc/vim/source/vars.vim
lib/php/http.php
lib/php/mime.php

index e944f262b7d6515dc3274d88fc6ce553e1bee7aa..cdc2f72aec46fce7845b29e4daf72502d9143016 100755 (executable)
@@ -34,6 +34,7 @@ get_options(\%Opt);
 #help() unless @ARGV;
 $main::_DATA_ = undef;
 $Opt{find} = 1 if $Opt{'find-only'};
+$Opt{extension} =~ s/^\.// if $Opt{extension};
 
 #################################################################################
 #
@@ -68,9 +69,11 @@ if ($Opt{find}) {
                follow_skip => 2,
                no_chdir => 1
        }, @ARGV);
-       #exit;
+       if ($Opt{'find-only'}) {
+               print map {"$_\n"} @WANTED_FILES;
+               exit;
+       }
        @ARGV = @WANTED_FILES;
-       exit if $Opt{'find-only'};
 }
 
 #
@@ -171,7 +174,7 @@ sub wanted {
        #warn "$file ".(-r $file ? "YES" : "NO");
 
        # Dont want the myself
-       return if myself($file);
+       return if &myself($file);
 
        my $hfile;
        open($hfile,"<","$file");
@@ -180,7 +183,8 @@ sub wanted {
                # Dont want the myself
                next if /$SHELL_IGNORE/;
 
-               next unless /^.{1,3}<SHELL_REPLACE/;
+               #next unless /^.{1,3}<SHELL_REPLACE/;
+               next unless /^\s*.{1,3}[=>]SHELL_REPLACE/;
 
                verbose(1,"Found: $file");
                push @WANTED_FILES, $file;
index 58f291ed8facb5bc94a51f7e179cb1dd1a89361c..9dfad210937855778dda55212ff1810016f041e4 100644 (file)
@@ -86,7 +86,7 @@ nb_php() {
 nb_api() {
        local uri="$1"; shift
   local auth=""
-  #=SHELL_REPLACE echo ssh root@ldap.nbdom.net grep CLEARTEXT /etc/ldap/nbdom.net/auth/nb.ldif | awk -F '}' '{print "NB_AUTH=\"nb:"$2"\""}'
+  #=SHELL_REPLACE ssh root@ldap.nbdom.net grep CLEARTEXT /etc/ldap/nbdom.net/auth/nb.ldif | awk -F '}' '{print "auth=\"nb:"$2"\""}'
 
   [ -z "$auth" ] && auth="nb:0TXARcQUpjHZctoROA2X.weWSZKM5DGT"
 
index 5e6b39992ec5800c3cdc699e059b04288e7b4958..e96bd4f5bcd1b84a416789d72ead8e5c46d52047 100644 (file)
@@ -9,7 +9,7 @@ let mimeExt = {
 let mimeAliases = {
        \ 'sh' : 'bash'
 \}
-">SHELL_REPLACE dbq db=nb t=meta action=table.rows rows.fields=key,val cat=file.check format=vim_hash name=mimeCheck preff="$(printf "\t")"
+">SHELL_REPLACE dbq db=nb t=meta action=table.rows rows.fields=key,val cat=file.check orderby=key format=vim_hash name=mimeCheck preff="$(printf "\t")"
 let mimeCheck = {
        \ 'awk'    : 'awk < /dev/null --lint=no-ext --file'
        \,'bash'   : 'bash -c'
@@ -30,7 +30,7 @@ let mimeCheck = {
 \}
 "<SHELL_REPLACE
 
-">SHELL_REPLACE dbq.php nb meta ls key,val cat=mime.comment format=vim_hash preff="$(printf "\t")" name=mimeComment
+">SHELL_REPLACE dbq.php nb meta ls key,val cat=mime.comment orderby=key format=vim_hash preff="$(printf "\t")" name=mimeComment
 let mimeComment = {
        \ 'bindzone'  : ';'
        \,'c'         : '//'
index 911d9798b014362542ad6407cd8de48001c99594..017f4e24236de5c246be0ce90ec79e89461c9f0a 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 class Http {
   const Status = [
-#>SHELL_REPLACE dbq.php /$NB_DB/http_status/ls/id,name orderby=id format=php_hash preff=$'\t'
+#>SHELL_REPLACE dbq.php /$NB_DB/http_status/ls/id,name orderby=id format=php_hash preff="$(printf '\t\t')"
        "100" => "Continue",
        "101" => "Switching Protocols",
        "102" => "Processing",
index 8c9558c0b2e4604eda138c57e9c79ca23017296b..60af090a6dbe098fbfe299a47e422785b0a0de76 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 class Mime {
        const Types = [
-#>SHELL_REPLACE dbq "/pub/mime/ls/type,ext.php_hash?preff=%09%09"
+#>SHELL_REPLACE dbq "/pub/mime/ls/type,ext.php_hash?preff=%09%09&orderby=type"
                "application/applixware"                                                    => "aw",
                "application/atomcat+xml"                                                   => "atomcat",
                "application/atomsvc+xml"                                                   => "atomsvc",