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

Re: [patch] _init_d add OpenBSD bits



On Wed, Jan 13, 2016 at 12:57:34AM +0000, Daniel Shahaf wrote:
> 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.)

-f overrides <daemon>_flags=NO for the start action like FreeBSD's
onestart. It doesn't override the rc_<action>=NO statements.
> 
> > +    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?

Indeed! I didn't realize _arguments parses it's arguments.



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