mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2024-11-26 01:32:48 +02:00
ds-catq.pl: allow selecting multiple values and added a test mode.
- boom/dist/dk/dk-catq.pl: allow multiple values of a parameter to be selected - boom/dist/dk/dk-catq.pl: new option -t to run in test mode, in which the resulting pages are not downloaded but only the URL leading to them is printed
This commit is contained in:
parent
58bca0e24e
commit
331094ec8f
20
boom/dist/dk/dk-catq.pl
vendored
20
boom/dist/dk/dk-catq.pl
vendored
@ -24,6 +24,11 @@ sub query
|
|||||||
# --- Read query specification ------------------------------------------------
|
# --- Read query specification ------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
if ($ARGV[0] eq "-t") {
|
||||||
|
$test = 1;
|
||||||
|
shift @ARGV;
|
||||||
|
}
|
||||||
|
|
||||||
$spec = $ARGV[0];
|
$spec = $ARGV[0];
|
||||||
|
|
||||||
while (<>) {
|
while (<>) {
|
||||||
@ -38,7 +43,7 @@ $key = shift @q;
|
|||||||
$cat = shift @q;
|
$cat = shift @q;
|
||||||
for (@q) {
|
for (@q) {
|
||||||
die "not a field=value pair: \"$_\"" unless /\s*=\s*/;
|
die "not a field=value pair: \"$_\"" unless /\s*=\s*/;
|
||||||
$f{$`} = $';
|
push(@{ $f{$`} }, $');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -91,10 +96,21 @@ for (@q) {
|
|||||||
for (keys %f) {
|
for (keys %f) {
|
||||||
$field = $col_field{$_};
|
$field = $col_field{$_};
|
||||||
die "no such field: $_" unless defined $field;
|
die "no such field: $_" unless defined $field;
|
||||||
$value = $val{$_}{$f{$_}};
|
for $v (@{ $f{$_} }) {
|
||||||
|
$value = $val{$_}{$v};
|
||||||
die "no such value: \"$_\"=\"$f{$_}\"" unless defined $value;
|
die "no such value: \"$_\"=\"$f{$_}\"" unless defined $value;
|
||||||
$url .= "&$field=$value";
|
$url .= "&$field=$value";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# --- Stop here if in test mode -----------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
if ($test) {
|
||||||
|
print "$url\n";
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# --- Output file header ------------------------------------------------------
|
# --- Output file header ------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user