Commit b3cc8017 authored by Alessandro Ghedini's avatar Alessandro Ghedini
Browse files

zsh.pl: escape ':' character

':' is interpreted as separator by zsh, so if used as part of the argument
or option's description it needs to be escaped.

The problem can be reproduced as follows:

 % curl --reso<TAB>
 % curl -E <TAB>

Bug: https://bugs.debian.org/921452
parent dbd32f32
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -45,9 +45,12 @@ sub parse_main_opts {

        my $option = '';

        $arg =~ s/\:/\\\:/g if defined $arg;

        $desc =~ s/'/'\\''/g if defined $desc;
        $desc =~ s/\[/\\\[/g if defined $desc;
        $desc =~ s/\]/\\\]/g if defined $desc;
        $desc =~ s/\:/\\\:/g if defined $desc;

        $option .= '{' . trim($short) . ',' if defined $short;
        $option .= trim($long)  if defined $long;