Fix for multiple range expansion

Allow ranges such as 'h{a,b}{1,2}' to expand to 'ha1 ha2 hb1 hb2' rather
than return a perl error

Thanks to Markus Frosch (lazyfrosch).

Github issue #97.
This commit is contained in:
Duncan Ferguson 2017-11-18 11:52:39 +00:00
parent f2194ecdfa
commit 93432c1580
5 changed files with 8 additions and 2 deletions

View file

@ -1,3 +1,6 @@
4.10_03 ????-??-?? Duncan Ferguson <duncan_ferguson@user.sf.net>
- Fix for multiple range expansion, as in 'h{a,b}{1,2}' (Github issue #97) (Thanks to lazyfrosch)
4.10_02 2017-08-08 Duncan Ferguson <duncan_ferguson@user.sf.net>
- Include coverage tests in the resources
- Include the version of cssh in the utility documentation and README

1
THANKS
View file

@ -47,3 +47,4 @@ Deny Dias
Bill Rushmore
Ankit Vadehra
Azenet
Markus Frosch (lazyfrosch)

View file

@ -3,7 +3,7 @@ package App::ClusterSSH;
use 5.008.004;
use warnings;
use strict;
use version; our $VERSION = version->new('4.10_02');
use version; our $VERSION = version->new('4.10_03');
use Carp qw/cluck :DEFAULT/;

View file

@ -62,7 +62,7 @@ sub expand {
next;
}
my ( $base, $spec ) = $item =~ m/^(.*?\{(.*)\}.*?)$/;
my ( $base, $spec ) = $item =~ m/^(.*?\{(.*?)\}.*?)$/;
for my $section ( split( /,/, $spec ) ) {
my ( $start, $end );

View file

@ -23,6 +23,8 @@ my %tests = (
'l{0..2,7..9,e..g}' => 'l0 l1 l2 l7 l8 l9 le lf lg',
'm{0,1}' => 'm0 m1',
'n0..2}' => 'n0..2}',
'host{a,b}-test{1,2}' =>
'hosta-test1 hosta-test2 hostb-test1 hostb-test2',
# NOTE: the following are not "as expected" in line with above tests
# due to bsd_glob functionality. See output from: