summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip Sequeira <phsequei@gmail.com>2015-03-29 23:30:10 -0400
committerwm4 <wm4@nowhere>2015-03-31 15:05:08 +0200
commitd6b102cab083150bd8ec6a103b20fa69a414550a (patch)
tree9738d233f719d3babc3bc5684c753c0fb24c42fb
parent5035501037fe3cf8c56edd31161ea26066c08fdf (diff)
downloadmpv-d6b102cab083150bd8ec6a103b20fa69a414550a.tar.bz2
mpv-d6b102cab083150bd8ec6a103b20fa69a414550a.tar.xz
TOOLS/zsh.pl: cosmetics
-rwxr-xr-xTOOLS/zsh.pl51
1 files changed, 25 insertions, 26 deletions
diff --git a/TOOLS/zsh.pl b/TOOLS/zsh.pl
index b53ca52dd6..b49c976b59 100755
--- a/TOOLS/zsh.pl
+++ b/TOOLS/zsh.pl
@@ -34,36 +34,35 @@ chomp $af_str;
$vf_str .= qq{ '$_' \\\n} foreach (@vf);
chomp $vf_str;
-$protos_str .= qq{$_ } foreach (@protos);
-chomp $protos_str;
+$protos_str = join(' ', @protos);
my $profile_comp = <<'EOS';
- local -a profiles
- local current
- for current in "${(@f)$($words[1] --profile=help)}"; do
- current=${current//\*/\\\*}
- current=${current//\:/\\\:}
- current=${current//\[/\\\[}
- current=${current//\]/\\\]}
- if [[ $current =~ $'\t'([^$'\t']*)$'\t'(.*) ]]; then
- if [[ -n $match[2] ]]; then
- current="$match[1][$match[2]]"
- else
- current="$match[1]"
- fi
- profiles=($profiles $current)
+ local -a profiles
+ local current
+ for current in "${(@f)$($words[1] --profile=help)}"; do
+ current=${current//\*/\\\*}
+ current=${current//\:/\\\:}
+ current=${current//\[/\\\[}
+ current=${current//\]/\\\]}
+ if [[ $current =~ $'\t'([^$'\t']*)$'\t'(.*) ]]; then
+ if [[ -n $match[2] ]]; then
+ current="$match[1][$match[2]]"
+ else
+ current="$match[1]"
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
+ profiles=($profiles $current)
+ 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
chomp $profile_comp;