Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

refactor perl code of 'vs -i lang'

  • Loading branch information...
commit 1e19b0bbeae2af8a407a70f2603a8cd9520315ac 1 parent afa9bec
@kwatch authored
Showing with 15 additions and 5 deletions.
  1. +15 −5 scripts/versionswitcher.sh
View
20 scripts/versionswitcher.sh
@@ -334,13 +334,18 @@ __vs_installable_versions() {
$rexp = q`'$rexp'`;
$none = "'$none'";
while (<>) {
- push @{$d{$1}}, length($2) ? $2 : $none if /$rexp/;
+ #push @{$d{$1}}, length($2) ? $2 : $none if /$rexp/;
+ if (/$rexp/) {
+ my $ver = $1;
+ my $patch = length($2) ? $2 : $none;
+ push @{$d{$ver}}, $patch;
+ }
}
sub norm { join ".", map { sprintf("%03d", $_) } split(/\./, $_[0]) }
for (sort keys %d) {
- @arr = sort {$a<=>$b} @{$d{$_}};
- $ver = $#arr ? $sep."{".join(",", @arr)."}" : (length($arr[0]) ? "$sep$arr[0]" : "");
- print "$_$ver\n";
+ @arr = sort {$a<=>$b} @{$d{$_}};
+ $verstr = $#arr ? $sep."{".join(",", @arr)."}" : (length($arr[0]) ? "$sep$arr[0]" : "");
+ print "$_$verstr\n";
}
'
else
@@ -349,7 +354,12 @@ __vs_installable_versions() {
$rexp = q`'$rexp'`;
$none = "'$none'";
while (<>) {
- push @arr, (($v = $2 ne "" ? $2 : $none) ne "" ? "$1$sep$v" : $1) if /$rexp/;
+ #push @arr, (($v = $2 ne "" ? $2 : $none) ne "" ? "$1$sep$v" : $1) if /$rexp/;
+ if (/$rexp/) {
+ my $ver = $1;
+ my $patch = $2 ne "" ? $2 : $none;
+ push @arr, ($patch ne "" ? "$ver$sep$patch" : $ver);
+ }
}
print $_, "\n" for sort @arr;
'
Please sign in to comment.
Something went wrong with that request. Please try again.