1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-23 16:48:49 -05:00

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
This commit is contained in:
Alessandro Ghedini 2019-02-05 21:06:26 +00:00
parent dbd32f3241
commit b3cc8017b7

View File

@ -45,9 +45,12 @@ sub parse_main_opts {
my $option = ''; 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;
$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($short) . ',' if defined $short;
$option .= trim($long) if defined $long; $option .= trim($long) if defined $long;