File pmount-zsh_completion of Package pmount

#compdef pmount pumount

local curcontext="$curcontext" ret=1

_udevordir(){
  local tmp dev_tmp mp_tmp

  tmp=( "${(@f)$(< /etc/mtab)}" )
  dev_tmp=( "${(@)${(@)tmp%% *}:#none}" )
  mp_tmp=( "${(@)${(@)tmp#* }%% *}" )

  _alternative \
    'devices:device:compadd -a dev_tmp' \
    'directories:mount point:compadd -a mp_tmp'
}

if [[ $words[1] = pmount ]]; then
  _arguments -S \
    '(-h --help)'{-h,--help}'[show help]' \
    '--version[show version]' \
    '-r[force mount read-only]' \
    '-w[force mount read-write]' \
    '(-s --sync)'{-s,--sync}'[mount with the "sync" option]' \
    '--noatime[mount with the "noatime" option]' \
    '(-e --exec)'{-e,--exec}'[mount with the "exec" option]' \
    '-t[specify file system type]:file system type:_file_systems' \
    '-c[specify I/O character set]:charset'\
    '-u[specify umask]: :_guard "[0-7]#" "octal umask"' \
    '--passphrase[read passphrase from file instead of the terminal]:file:_files' \
    '(-d --debug)'{-d,--debug}'[enable debug output]' \
    ':device:_files -g "*(-%b)"' \
    ':label:'&& ret=0
else
  # Completion for pumount.
  _arguments -S \
    '(-h --help)'{-h,--help}'[show help]' \
    '--version[show version]' \
    '(-l --lazy)'{-l,--lazy}'[lazy unmount]' \
    '(-d --debug)'{-d,--debug}'[enable debug output]' \
    '*:device or mountpoint:_udevordir' && ret=0
fi

return ret
openSUSE Build Service is sponsored by