From 10b5bfdee99e8161f353593ee3e85f4775b1dedc Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 09:40:50 +0200 Subject: Adding upstream version 3.0.13. Signed-off-by: Daniel Baumann --- dkms.zsh-completion.in | 142 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 dkms.zsh-completion.in (limited to 'dkms.zsh-completion.in') diff --git a/dkms.zsh-completion.in b/dkms.zsh-completion.in new file mode 100644 index 0000000..32e9091 --- /dev/null +++ b/dkms.zsh-completion.in @@ -0,0 +1,142 @@ +#compdef dkms +# Based on the completion from the zsh-users/zsh repository. + +local curcontext="$curcontext" ign cmds opts ret=1 +local -a state line expl args subcmds dirs +local -A opt_args + +subcmds=( + 'add:add a module/version combination to the tree for builds and installs' + 'remove:remove a module from the tree' + 'build:compile a module for a kernel' + 'unbuild:undoes the build of a module' + "install:install a build module for it's corresponding kernel" + 'uninstall:uninstall a module for a kernel' + 'autoinstall:try to install the latest revision of all modules that have been installed for other kernel revisions' + 'match:install every module that is installed for a template kernel for another kernel' + 'mktarball:tar up files in the DKMS tree for a specific module' + 'ldtarball:extract a tarball created with mktarball into the DKMS tree' + 'status:display the current status of modules, versions and kernels within the tree' +) + +args=( + '(--all)*'{-a,--arch}'[specify system architecture]:architecture:->architectures' + '(1)-m[specify module]:module:->modules' + '(1)-v[specify module version]:version' + {-q,--quiet}'[suppress output]' + '*--directive=:directive' + '--dkmstree=:path:_directories' + '--installtree=:path:_directories' + '--sourcetree=:path:_directories' + '--force-version-override' + '1: : _describe -t commands command subcmds' +) + +cmd=${${${subcmds%%:*}:*words}[1]} +if [[ -n $cmd ]]; then + curcontext="${curcontext%:*}-$cmd:" +else + # Exclude sub-commands based on any options specified so far. + for cmds opts in \ + '(remove|build|install|uninstall|match|status|mktarball)' 'k' \ + '(add|remove)' '-_safe_upgrade' \ + 'mktarball' '-(source|binary)-only' \ + '(match|build)' '(k|-no-(prepare|clean)-kernel|-kernelsourcedir)' \ + '(|un)install' '-no-(depmod|initrd)' \ + '(add|build|install|ldtarball)' '-force' \ + 'match' '-templatekernel' \ + '(mktarball|ldtarball)' '-archive' \ + '(match|build)' '(j*|-no-(prepare|clean)-kernel|-kernelsourcedir)' \ + '(remove|build|install|status|mktarball)' '-all' \ + 'build' '-config' + do + [[ -n ${(M)words:#-${~opts}*} ]] && + subcmds=( ${(M)subcmds:#${~cmds}:*} ) + done + args+=( '(1 -)'{-V,--version}'[display version information]' ) + ign='!' # hide some uncommon options but handle their arguments +fi + +case $cmd in + remove|build|install|uninstall|mktarball|status) + args+=( ': :->modules' ) + ;| + |remove|(un|)build|install|uninstall|match|status|mktarball) + args+=( '(--all)*-k[specify kernel version]:kernel:->kernels' ) + ;| + |add|remove) args+=( "${ign}--rpm_safe_upgrade" ) ;| + |(mk|ld)tarball) + args+=( "${ign}--archive=:tarball:_files -g '*.tar(-.)'" ) + ;| + |mktarball) args+=( "${ign}(--source-only --binaries-only)--"{source,binaries}-only ) ;| + |match|build) + args+=( # TODO: check ignore needed in absence of parameters + "${ign}--no-prepare-kernel" + "${ign}--no-clean-kernel" + '--kernelsourcedir=:directory:_directories' + "${ign}-j+[specify maximum number of jobs to use when building]:jobs" + ) + ;| + |(|un)install) + args+=( + "${ign}--no-depmod" + "${ign}--no-initrd" + ) + ;| + |add) + args+=( + '-c[specify location of dkms.conf file]:location:_files' + ) + ;| + |remove|(un|)build|install|status) + args+=( '(-a --arch -k)--all[specify all relevant kernels/arches]' ) + ;| + |build) + args+=( "${ign}--config=:kernel config file:_files" ) + ;| + |add|build|install|ldtarball) + args+=( '--force[force overwriting of extant files]' ) + ;| + |match) + args+=( "${ign}--templatekernel=:kernel:->kernels" ) + ;| + add) + args+=( + '3:path:_directories' + '4:tarball:_files -g "*.tar(-.)"' + ) + ;; + install) + args+=( + '3:rpm file:_files -g "*.rpm(-.)"' + ) + ;; +esac + +_arguments -C $args && ret=0 + +case $state in + modules) + dirs=( ${(e)opt_args[--dkmstree]:-/var/lib/dkms}/*/*(/) ) + dirs=( ${${(M)dirs%/*/*}#/} ) + _description modules expl module + _multi_parts -i "$expl[@]" / dirs && ret=0 + ;; + kernels) + if compset -P 1 '*/'; then + _description architectures expl architecture + compadd "$expl[@]" @MODDIR@/$IPREFIX/build/arch/*(/:t) && ret=0 + else + compset -S '/*' + dirs=( @MODDIR@/*(/:t) ) + _description -V kernels expl kernel + compadd "$expl[@]" -r "/ \t\n\-" ${(on)dirs} && ret=0 + fi + ;; + architectures) + _description architectures expl architecture + compadd "$expl[@]" /lib/modules/$(uname -r)/build/arch/*(/:t) && ret=0 + ;; +esac + +return ret -- cgit v1.2.3