TOOLS/zsh.pl: cosmetics

This commit is contained in:
Philip Sequeira 2015-03-29 23:30:10 -04:00 committed by wm4
parent 5035501037
commit d6b102cab0
1 changed files with 25 additions and 26 deletions

View File

@ -34,36 +34,35 @@ chomp $af_str;
$vf_str .= qq{ '$_' \\\n} foreach (@vf); $vf_str .= qq{ '$_' \\\n} foreach (@vf);
chomp $vf_str; chomp $vf_str;
$protos_str .= qq{$_ } foreach (@protos); $protos_str = join(' ', @protos);
chomp $protos_str;
my $profile_comp = <<'EOS'; my $profile_comp = <<'EOS';
local -a profiles local -a profiles
local current local current
for current in "${(@f)$($words[1] --profile=help)}"; do for current in "${(@f)$($words[1] --profile=help)}"; do
current=${current//\*/\\\*} current=${current//\*/\\\*}
current=${current//\:/\\\:} current=${current//\:/\\\:}
current=${current//\[/\\\[} current=${current//\[/\\\[}
current=${current//\]/\\\]} current=${current//\]/\\\]}
if [[ $current =~ $'\t'([^$'\t']*)$'\t'(.*) ]]; then if [[ $current =~ $'\t'([^$'\t']*)$'\t'(.*) ]]; then
if [[ -n $match[2] ]]; then if [[ -n $match[2] ]]; then
current="$match[1][$match[2]]" current="$match[1][$match[2]]"
else else
current="$match[1]" current="$match[1]"
fi
profiles=($profiles $current)
fi fi
done profiles=($profiles $current)
if [[ $state == show-profile ]]; then
# For --show-profile, only one allowed
if (( ${#profiles} > 0 )); then
_values 'profile' $profiles && rc=0
fi
else
# For --profile, multiple allowed
profiles=($profiles 'help[list profiles]')
_values -s , 'profile(s)' $profiles && rc=0
fi fi
done
if [[ $state == show-profile ]]; then
# For --show-profile, only one allowed
if (( ${#profiles} > 0 )); then
_values 'profile' $profiles && rc=0
fi
else
# For --profile, multiple allowed
profiles=($profiles 'help[list profiles]')
_values -s , 'profile(s)' $profiles && rc=0
fi
EOS EOS
chomp $profile_comp; chomp $profile_comp;