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

Re: PATCH: _module-assistant



Hi.

Please incorporate whatever you want from my version of _module-assistant

#compdef module-assistant m-a

_module-assistant() {
  _arguments - -A \
    '(-t --text)'{-t,--text}"[don't use dialog UI]" \
    '(-k --kerneldir)'{-k,--kerneldir}'[kernel source directory]:kernel source directory:_files -/' \
    '(-l --kvers-list)'{-l,--kvers-list}'[list of kernel version numbers]:kernel version number:' \
    '(-v --verbose)'{-v,--verbose}'[show more informations]' \
    '(-n --no-rebuild)'{-n,--no-rebuild}'[don''t rebuild existing packages]' \
    '(-f --force)'{-f,--force}'[force build/download]' \
    '(-u --user-dir)'{-u,--user-dir}'[override default dir]:directory:_files -/' \
    '(-i --ignore-failures)'{-i,--ignore-failures}'[ignore failed builds]' \
    '(-s --apt-search)'{-s,--apt-search}'[use apt-cache for searching]' \
    '(-h --help)'{-h,--help}'[print usage overview]' \
    '*::command:_m-a-commands'
}

_m-a-commands() {
  local cmd ret=1 m_a_commands

  m_a_commands=(
    update:"synchronize version index files"
    prepare:"install required kernel headers package"
    fakesource:"install required kernel source package"
    list:"a print a list of details about available packages"
    list-available:"b print a list of details about available packages "
    la:"c print a list of details about available packages  "
    list-installed:" print a list of details about installed packages "
    li:"print a list of details about installed packages  "
    search:"search for packages"
    get:"install specified source package"
    build:"build specified packages"
    install:"install specified packages"
    auto-install:"do all necessary steps to install specified packages"
    clean:"clear build directories of the kernel packages"
    purge:"clear cache and remove all binary packages of source package"
  )

  if (( CURRENT == 1 )); then
    _describe -t commands 'module-assistant command' m_a_commands
  else
    case $words[1] in
      (update|prepare|fakesource|clean)
        cmd=noop
        ;;
      (list*|la|li|search)
        cmd=ep
        ;;
      (get|build|(|auto-)install|purge)
        cmd=bp
        ;;
    esac

    _tags commands && _call_function ret _m-a-$cmd
  fi
  return ret
}

_m-a-noop() {
  _message nothing
}

_m-a-bp() {
  _wanted "package" expl "source package" \
    compadd -- /var/cache/modass/*.avail_version(:t:r)
    #compadd -- /usr/share/modass/packages/^generic.sh(:t)

    # which one of the above is better? don't know enough about m-a to
    # decide :-/
}

_m-a-ep() {
  _wanted "package" expl "source package" \
    compadd -- /var/cache/modass/*.avail_version(:t:r) all alli
    #compadd -- /usr/share/modass/packages/^generic.sh(:t) all alli

    # which one of the above is better? don't know enough about m-a to
    # decide :-/
}

_module-assistant "$@"



-- 
Stephen Rüger
stephen.rueger@xxxxxxxxxxxxxxx



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