#compdef cryptfs

local expl context state line
typeset -A opt_args

_arguments \
  '(-f --filename)'{-f,--filename}"[configuration file]:configuration file:_files -g \"*.xml(-.)\"" \
  '(-f --ignore)'{-i,--ignore}"[Ignore unknown actions.]" \
  '(-m, --only-map)'{-m,--only-map}"[Don't fsck and mount.]" \
  '(-n, --only-mount)'{-n,--only-mount}"[Do everything after mapping.]" \
  '(-e, --no-enc)'{-e,--no-enc}"[Don't encrypt, just map the area.]" \
  '(-r, --remove)'{-r,--remove}"[Remove mappings]" \
  '(-s, --syslog)'{-s,--syslog}"[Send error messages to syslog.]" \
  '(-h, --help)'{-h,--help}"[Show options.]" \
  '*:action:->action' && return 0

case "$state" in
  (action)
    vals=( ${(f)"$(_call_program actions $words[1] ${(kv)opt_args[(i)-f|--filename]} 2>/dev/null)"} )
    _describe -t actions 'action' vals && ret=0
  ;;
esac
