Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: fix zstyle context handling



On Tue, Oct 21, 2014 at 8:34 PM, Oliver Kiddle <okiddle@xxxxxxxxxxx> wrote:
> As I mentioned last week, bad handling of zstyle contexts with
> _arguments/_values is not uncommon in our completion functions. I had
> made a note of offending functions at the time and this patch fixes many
> cases.
>
> Oliver
>
> diff --git a/Completion/Unix/Command/_su b/Completion/Unix/Command/_su
> index 6d0f2cd..989aa96 100644
> --- a/Completion/Unix/Command/_su
> +++ b/Completion/Unix/Command/_su
> @@ -1,9 +1,9 @@
>  #compdef su
>
>  local -A opt_args
> -local -a args state context
> +local -a args context state line expl
>  local shell=${words[(i)(-s|--shell=*)]} first='1:user name:_users'
> -local usr=root line
> +local usr=root
>
>  if _pick_variant gnu="Free Software Foundation" unix --version; then
>    args=(
> @@ -20,10 +20,20 @@ if _pick_variant gnu="Free Software Foundation" unix --version; then
>    )
>  else
>    args=(
> -    '-c[pass command to shell]:command string:->command'
>      '-l[use a login shell]'
>      '-s[run the specified shell]:shell:->shell'
>    )
> +  case $OSTYPE in
> +  freebsd*)
> +    args=(
> +      '-c[use settings from specified login class]:class'
> +      '-f[if the invoked shell is csh, prevent it from reading ,cshrc]'
> +      '-l[use a login shell]'
> +      '-m[do not reset environment]'
> +      '-s[set the MAC label]'
> +    )
> +  *) args+=( '-c[pass command to shell]:command string:->command' ) ;;
> +  esac
>  fi
>
>  if [[ $#words -ge 2 && $words[2] != -* && CURRENT -ne 2 ]]; then

Missing a ;; after the freebsd* case, caused a parse error when
zcompiling my $fpath. I've committed the fix.

Thanks for looking through and fixing all of this by the way, it must
have been quite an effort.

-- 
Mikael Magnusson



Messages sorted by: Reverse Date, Date, Thread, Author