Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Id: Zsh Workers List <zsh-workers.zsh.org>
List-Post: <mailto:zsh-workers@zsh.org>
List-Help: <mailto:zsh-workers-help@zsh.org>
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham
	autolearn_force=no version=3.4.0
Date: Wed, 13 Jan 2016 00:57:34 +0000
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: Matthew Martin <phy1729@gmail.com>
Cc: zsh-workers@zsh.org
Subject: Re: [patch] _init_d add OpenBSD bits
Message-ID: <20160113005734.GA24858@tarsus.local2>
References: <20160110190157.GA4187@CptOrmolo.darkstar>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20160110190157.GA4187@CptOrmolo.darkstar>
User-Agent: Mutt/1.5.23 (2014-03-12)
X-Seq: zsh-workers 37589

Matthew Martin wrote on Sun, Jan 10, 2016 at 13:01:57 -0600:
> +  (( $+functions[_init_d_get_cmds] )) ||
> +  _init_d_get_cmds() {
> +    local -a cmds disabled
> +
> +    cmds=(start stop reload restart check)
> +    disabled=(${${${(M)${(f)"$(< $script)"}:#rc_(${(~j:|:)cmds})=NO}#rc_}%=NO})

Enhancement idea: only populate $disabled if -f isn't on the command line.
(This doesn't block the patch, in my opinion.)

> +    echo ${cmds:|disabled}
> +  }
> +
> +  flags=('-d[print debug information]' '-f[forcibly start the daemon]')
>  else
>    (( $+functions[_init_d_fullpath] )) ||
>    _init_d_fullpath() {
> @@ -90,4 +107,4 @@ cmds=( $(_init_d_get_cmds) ) || return
>  (( $#cmds )) || zstyle -a ":completion:${curcontext}:commands" commands cmds ||
>      cmds=(start stop)
>  
> -_sub_commands $cmds
> +_arguments -s -A "-*" $flags "*:init.d command:_sub_commands $cmds"

Surely these should be single quotes around the last argument?

