#compdef rmdir grmdir zf_rmdir

local variant
local -a args aopts=( -A '-*' )

args=(
  '(-p --parents)'{-p,--parents}'[remove each component of the specified paths]'
)

_pick_variant -r variant -b zsh gnu=GNU $OSTYPE --version
case $variant; in
  gnu)
    aopts=()
    args+=(
      '--ignore-fail-on-non-empty[ignore failure if directory is non-empty]'
      '(-v --verbose)'{-v,--verbose}'[be verbose]'
    )
    ;;
  zsh)
    args=()
    ;;
  *)
    args=(${args:#*\)--*})
    ;|
  dragonfly*|freebsd*)
    args+=('-v[be verbose]')
    ;;
esac

_arguments -s -S $aopts \
  $args \
  '*: :_directories'
