zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: _module-assistant
@ 2005-04-17 16:15 Clint Adams
  2005-04-17 16:59 ` Stephen Rueger
  0 siblings, 1 reply; 3+ messages in thread
From: Clint Adams @ 2005-04-17 16:15 UTC (permalink / raw)
  To: zsh-workers

This is a bit lacking.

Index: Completion/Debian/Command/_module-assistant
===================================================================
RCS file: Completion/Debian/Command/_module-assistant
diff -N Completion/Debian/Command/_module-assistant
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Completion/Debian/Command/_module-assistant	17 Apr 2005 16:14:06 -0000
@@ -0,0 +1,17 @@
+#compdef module-assistant m-a
+
+_arguments \
+ '(-h --help)'{-h,--help}'[print help screen]' \
+ '(-v --verbose)'{-v,--verbose}'[Be verbose, show full paths, etc.]' \
+ '(-q --quiet)'{-q,--quiet}'[The opposite of verbose]' \
+ '(-n --no-rebuild)'{-n,--no-rebuild}'[Do not rebuild when package exists]' \
+ '(-i --ignore-failures)'{-i,--ignore-failures}'[Do not stop on build failures]' \
+ '(-s --apt-search)'{-s,--apt-search}'[Search for installation candidates in the Debian archive]' \
+ '(-f --force)'{-f,--force}'[Force using new versions even when old ones exist]' \
+ '(-u --userdir)'{-u,--userdir}'[Specify a (writable) replacement directory for /var&/usr]:dir:_files -/' \
+ '(-l --kvers-list)'{-l,--kvers-list}'[List of kernel versions to work on (default: current version)]:kernel version list:' \
+ '(-k --kernel-dir)'{-k,--kernel-dir}'[List of kernel headers/source directories, comma separated]:list of dirs:_files -/' \
+ '(-t --text-mode)'{-t,--text-mode}'[no progress bars]' \
+ '1:list of commands:_values -s , subcommands update get build list install auto-install prepare clean purge' \
+ '*:packages: compadd ${${${$(ls /usr/src/modass/var_cache_modass/*.avail_version)}:t}%.avail_version}'
+


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PATCH: _module-assistant
  2005-04-17 16:15 PATCH: _module-assistant Clint Adams
@ 2005-04-17 16:59 ` Stephen Rueger
  2005-04-17 18:46   ` Clint Adams
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Rueger @ 2005-04-17 16:59 UTC (permalink / raw)
  To: zsh-workers

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2893 bytes --]

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@rechnerpost.org


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PATCH: _module-assistant
  2005-04-17 16:59 ` Stephen Rueger
@ 2005-04-17 18:46   ` Clint Adams
  0 siblings, 0 replies; 3+ messages in thread
From: Clint Adams @ 2005-04-17 18:46 UTC (permalink / raw)
  To: Stephen Rueger; +Cc: zsh-workers

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

Great, thanks for sharing.

This should combine all the features except the completion of "all" or
"alli" if any of the appropriate subcommands are on the line.

Index: Completion/Debian/Command/_module-assistant
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Debian/Command/_module-assistant,v
retrieving revision 1.1
diff -u -r1.1 _module-assistant
--- Completion/Debian/Command/_module-assistant	17 Apr 2005 16:17:52 -0000	1.1
+++ Completion/Debian/Command/_module-assistant	17 Apr 2005 18:43:30 -0000
@@ -1,6 +1,26 @@
 #compdef module-assistant m-a
 
-_arguments \
+typeset -a _module_assistant_commands
+
+_module_assistant_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]"
+)
+
+_arguments -A \
  '(-h --help)'{-h,--help}'[print help screen]' \
  '(-v --verbose)'{-v,--verbose}'[Be verbose, show full paths, etc.]' \
  '(-q --quiet)'{-q,--quiet}'[The opposite of verbose]' \
@@ -12,6 +32,6 @@
  '(-l --kvers-list)'{-l,--kvers-list}'[List of kernel versions to work on (default: current version)]:kernel version list:' \
  '(-k --kernel-dir)'{-k,--kernel-dir}'[List of kernel headers/source directories, comma separated]:list of dirs:_files -/' \
  '(-t --text-mode)'{-t,--text-mode}'[no progress bars]' \
- '1:list of commands:_values -s , subcommands update get build list install auto-install prepare clean purge' \
- '*:packages: compadd ${${${$(ls /usr/src/modass/var_cache_modass/*.avail_version)}:t}%.avail_version}'
+ '1:list of commands:_values -s , subcommands "${_module_assistant_commands[@]}"' \
+ '*:packages: compadd /usr/src/modass/var_cache_modass/*.avail_version(N:t:r) /var/cache/modass/*.avail_version(N:t:r)'
 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-04-17 18:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-17 16:15 PATCH: _module-assistant Clint Adams
2005-04-17 16:59 ` Stephen Rueger
2005-04-17 18:46   ` Clint Adams

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).