zsh-5.3-init.d-gentoo.diff 1.0 KB

1234567891011121314151617181920212223242526272829303132
  1. --- zsh-5.3/Completion/Unix/Command/_init_d
  2. +++ zsh-5.3/Completion/Unix/Command/_init_d
  3. @@ -1,6 +1,6 @@
  4. #compdef -p */(init|rc[0-9S]#).d/*
  5. -local cmds script
  6. +local cmds script opts
  7. local -a flags
  8. _compskip=all
  9. @@ -102,10 +102,18 @@
  10. script=$words[1]
  11. [[ $script = */* ]] || script="$(_init_d_fullpath "$script")"
  12. +[[ ! -f $script ]] &&
  13. + { _message "${words[1]:t} is not an init script" && return }
  14. +
  15. cmds=( $(_init_d_get_cmds) ) || return 1
  16. -(( $#cmds )) || zstyle -a ":completion:${curcontext}:commands" commands cmds ||
  17. - cmds=(start stop)
  18. +(( $#cmds )) || zstyle -a ":completion:${curcontext}:commands" commands cmds
  19. +opts=(start stop restart pause zap status ineed iuse needsme usesme broken)
  20. +
  21. +# If we didn't get $cmds from a zstyle, then read init script for opts.
  22. +# If script doesn't specify opts, then default to the standard opts.
  23. +(( $#cmds )) || cmds=( ${(eQz)${(M)${(f)"$( <$script)"}:#[[:blank:]]#opts=*}#*=} )
  24. +(( $#cmds )) || cmds=($opts)
  25. _arguments -s -A "-*" $flags ':init.d command:_sub_commands $cmds'