]> git.nbdom.net Git - nb.git/commitdiff
dbq ssh proto
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Wed, 2 Mar 2016 02:44:37 +0000 (02:44 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Wed, 2 Mar 2016 02:44:37 +0000 (02:44 +0000)
bin/dbq

diff --git a/bin/dbq b/bin/dbq
index f4db121ef693b84560dc7aa856406221a4aa328c..2bf2bafa329e12222d77be46b2f3d2402d570f17 100755 (executable)
--- a/bin/dbq
+++ b/bin/dbq
@@ -54,11 +54,11 @@ my $CURL_OPT_EXP = join('|',map{ /^(.*?)\|/ ? $1 : $_ } @CURL_OPT);
 my $VERBOSE = $main::VERBOSE = 0;
 my $DEBUG = $main::DEBUG = 0;
 
-exec('ssh',$ARGV[0] && shift @ARGV,$NAME,@ARGV) if @ARGV and $ARGV[0] eq '--ssh' and shift @ARGV;
 csv2txt("\t",shift @ARGV) if @ARGV and $ARGV[0] eq '--csv2txt' and shift @ARGV;
 curl_help() if @ARGV and $ARGV[0] eq '--curl_help' and shift @ARGV;
 parse_debug() if @ARGV and $ARGV[0] eq '--parse_debug' and shift @ARGV;
 curl_help_hash() if @ARGV and $ARGV[0] eq '--curl_help_hash' and shift @ARGV;
+my @EXEC = @ARGV;
 
 my %Opt = map{ (/^(.*?)\|/ ? $1 : $_) => $CURL_OPT{$_} } keys %CURL_OPT;
 
@@ -91,7 +91,16 @@ for my $o (@CURL_OPT) {
 my @cmd;
 my $url;
 $url = ($ENV{$UC_NAME.'_URL'} ? $ENV{$UC_NAME.'_URL'} : '/opt/rent/www/index.php');
-$url = shift @ARGV if @ARGV and ($ARGV[0] =~ m|^\w+://| or -e $ARGV[0] );
+if (!$Opt{ssh} and @ARGV and ($ARGV[0] =~ m|^\w+://| or -e $ARGV[0] )) {
+  $url = shift @ARGV;
+  shift @EXEC;
+}
+#die $Opt{ssh};
+#exec('ssh',$ARGV[0] && shift @ARGV,$NAME,@ARGV) if @ARGV and $ARGV[0] eq '--ssh' and shift @ARGV;
+if ($url =~ m@^ssh://(.*)$@) {
+  $Opt{ssh} = $1;
+}
+exec('ssh',$Opt{ssh},$NAME,@EXEC) if $Opt{ssh};
 
 #
 # Distinct arg from key=value