]> git.nbdom.net Git - nb.git/commitdiff
option netrc
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Wed, 2 Mar 2016 10:22:05 +0000 (10:22 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Wed, 2 Mar 2016 10:22:05 +0000 (10:22 +0000)
bin/dbq

diff --git a/bin/dbq b/bin/dbq
index 2bf2bafa329e12222d77be46b2f3d2402d570f17..900c49387639a278f162e5735afbcc47d515f17c 100755 (executable)
--- a/bin/dbq
+++ b/bin/dbq
@@ -41,7 +41,7 @@ my %CURL_OPT = (
   'get|G!' => undef, # Send the -d data with a HTTP GET (H)
   'silent|s!' => 1, # Silent mode (don't output anything)
   'header|H=s' => \@H, # LINE   Pass custom header LINE to server (H)
-  #'header|H=s' => 1, #\@H, # LINE   Pass custom header LINE to server (H)
+  'netrc|n!', # Must read .netrc for user name and password
 );
 my @CURL_OPT = keys %CURL_OPT;
 my $CURL_OPT_EXP = join('|',map{ /^(.*?)\|/ ? $1 : $_ } @CURL_OPT);
@@ -57,7 +57,6 @@ my $DEBUG = $main::DEBUG = 0;
 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;
@@ -352,7 +351,7 @@ sub get_options {
 
 }
 
-sub curl_help_hash {
+sub curl_help {
   open(CURL,'curl --help |') or die "Can't run curl";
   my $o = $CURL_OPT_EXP;
   while (<CURL>) {
@@ -371,25 +370,7 @@ sub curl_help_hash {
   close CURL;
   exit;
 }
-sub curl_help {
-  open(CURL,'curl --help |') or die "Can't run curl";
-  my $o = $CURL_OPT_EXP;
-  while (<CURL>) {
-    #print $_;
-    #/^\s*(?:-(\w+),\s*)?--([\w-]+)(.*?)\$/ or next;
-    @_ = /(?:-(\w+).*?)?--($o)\s+(.*?)$/ or next;
-    #warn $_;
-    push(@_,'') if @_<3; $_[0] = '' unless $_[0];
-    $_[1] .= '|' if $_[0];
 
-    my $type = '!';
-    $type = '=s' if $_[2] =~ /^[A-Z]{2,}/;
-    #print "=item B<option[$_[1]$_[0]$type]> $_[2]\n\n";
-    print " option[$_[1]$_[0]$type] $_[2]\n";
-  }
-  close CURL;
-  exit;
-}
 __DATA__
 
 =head1 NAME