From: Nicolas Boisselier Date: Wed, 2 Mar 2016 10:22:05 +0000 (+0000) Subject: option netrc X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=d9de30c7a4d1ac83560ad68a14d238b6cecf4646;p=nb.git option netrc --- diff --git a/bin/dbq b/bin/dbq index 2bf2bafa..900c4938 100755 --- 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 () { @@ -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 () { - #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 $_[2]\n\n"; - print " option[$_[1]$_[0]$type] $_[2]\n"; - } - close CURL; - exit; -} __DATA__ =head1 NAME