]> git.nbdom.net Git - nb.git/commitdiff
etc/profile.d/functions
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Sat, 2 Dec 2017 03:00:04 +0000 (03:00 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Sat, 2 Dec 2017 03:00:04 +0000 (03:00 +0000)
etc/profile.d/functions
lib/php/db/dbq.php
share/db/update.sh

index a376b33bf4262b05d6352ad8f6f6ec513c272564..05f6f4b5b51bf83c07325ab81c098c0fd5b8e2f8 100644 (file)
@@ -758,6 +758,19 @@ while (@_) {
 }
 
 shell_replace() {
+
+  local usage="Usage: shell_replace [-i[.BACKUP_EXTENSION]] [-find PAHT]"
+  if [ -z "$*" -o "$1" = "--help" -o "$1" = "-h" ]; then
+    echo "$usage"
+    return
+  fi
+
+  if [ "$1" = "-find" ]; then
+    shift
+    grep -ErlI '^.{1,3}<SHELL_REPLACE' ${@:?$usage}
+    return
+  fi
+
   perl -ne '
 if (/^(\s*).{1,3}>SHELL_REPLACE (.*)$/ .. /^\s*.{1,3}<SHELL_REPLACE.*/){
   $ch = 1;
index 726cdbdff4d9110299b538ede8b0faa21b508788..64753c7d404bf3d4cfecc82d954740089b6c2d11 100644 (file)
@@ -9,7 +9,5 @@
 require_once(realpath(dirname(__FILE__).'/init.php'));
 if (!isset($Db)) global $Db, $Table;
 $Db->pdef('format',$Db->content_type2format());
-#$Db->pdef('action','db.ls');
-#bye(nb::P('action'));
 return $Db->action($Db->p('action'),$Table);
 ?>
index 9de55d2dc51596bc2818f9a99c247debbf2c1585..a3d521ac8a3df995bd9dfb4bb0243d2dd3d3f702 100755 (executable)
@@ -91,9 +91,15 @@ EOF
 #cp -a "$tmp/" /Users/nico/Downloads/commit/
 rm -rf "$tmp"
 
+(
+
+export DBQ_PARAMS="db=nb-sys"
+
 for f in $(grep -ErlI '^.{1,3}<SHELL_REPLACE' $NB_ROOT); do
 
   echo "Update $f" | sed "s; $NB_ROOT/; ;"
   shell_replace -i.shell_replace "$f"
 
 done
+
+)