dieren: mkimgthumb escape to support colons in parameters
authorMischa POSLAWSKY <perl@shiar.org>
Sat, 2 May 2020 23:22:11 +0000 (01:22 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Wed, 6 May 2020 01:18:07 +0000 (03:18 +0200)
Backslash to allow the occasional `-define modulate:colorspace=HSB`
as :-define:module\:colorspace=HSB.

tools/mkimgthumb

index 3c38e7cf2ce419d8033738c6acd5d14db1e4141e..e2b974dcf09e35ae7fdd27c3bdc3fbf7631880ee 100755 (executable)
@@ -5,12 +5,13 @@ use warnings;
 my $failcount = 0;
 
 for my $src (@ARGV) {
-       my ($name, @cmds) = split /:/, $src =~ s/\.(\w+)\z//r;
+       my ($name, @cmds) = split /:(?<!\\:)/, $src =~ s/\.(\w+)\z//r;
        my $ext = $1 // '*';
        next if $name =~ m/\./;
        unless (-e $src) {
                ($src) = grep {-e} glob qq<"$name"{,:*}.$ext> or next;
        }
+       s/\\(.)/$1/g for @cmds;
        say $name;
 
        if (@cmds and $cmds[0] =~ /^\d/) {