Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: completion clashes and SUSE/Mandriva functions
- X-seq: zsh-workers 33481
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Zsh workers <zsh-workers@xxxxxxx>
- Subject: PATCH: completion clashes and SUSE/Mandriva functions
- Date: Tue, 21 Oct 2014 09:26:06 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s1024; t=1413876367; bh=LAQ9BWwOP1Dvlagiq9hi6bLXJYt1UZTWwqn73kfUJvk=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:From:To:Subject:MIME-Version:Content-Type:Content-ID:Date:Message-ID; b=V0beiu/nmpkb5AL98PdPwOTpn59VuuylPYDrVQq92fMnDJ5pqV9SvWd2B/eDR6sRNtGQ1mTBRm8pLa0azHbCDwAw3uENXcNjs4HxQuLg4kUpIeNDoZw2vxrct9JY7G0Wz2HRvk/t4y+VthbL6bUYHKIQvJdY23g1KUO9dnFC3B0=
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
We seem to have ended up with duplicate completion functions for yast.
I think the old one was better, I've updated it and will move it to the
openSUSE directory: the Debian port of yast is long dead but it is
relevent to non "open" SUSE such as the SLES 11 box I just used to check
this on. I also updated _SUSEconfig at the same time. The command is
still called SuSEconfig, at least on SLES 11, so the function perhaps
shouldn't have been renamed.
We've also got a couple of other clashes where, e.g. _directories was
used for df but we now have _df.
Finally, for Mandriva we appear to have function that is running sudo:
local loader=$(sudo detectloader -q)
Any ideas on how to avoid that? I'd be inclined to just add matches for
both the GRUB and LILO boot entries or perhaps attempt detectloader in
case the user is already root.
For now, I've fixed style context handling in that function.
Oliver
diff --git a/Completion/Linux/Command/_yast b/Completion/Linux/Command/_yast
index f008b40..98585f0 100644
--- a/Completion/Linux/Command/_yast
+++ b/Completion/Linux/Command/_yast
@@ -3,9 +3,12 @@
_arguments \
'(- 1)'{-h,--help}'[display help information]' \
'(- 1)'{-l,--list}'[list all available modules]' \
- '(-g --geometry)'{-g,--geometry}'[specify default window size]:_x_geometry' \
- '(-s --style)'{-s,--style}'[specify widget style]:style:(qt)' \
+ '(-g --geometry --ncurses)'{-g,--geometry}'[specify default window size]:_x_geometry' \
+ '--qt[use the QT graphical frontend]' \
+ '--gtk[use the GTK graphical frontend]' \
+ '--ncurses[use the curses text-mode frontend]' \
'--noborder[no window manager border for main window]' \
'--fullscreen[use full screen]' \
'(-)'{-i,--install}'[install package]:*:package file:_files -g "*.rpm(-.)"' \
+ '(-)--remove[remove package]:*:package' \
'1:module:( ${${(f)"$($words[1] -l 2>/dev/null)"}[2,-1]##* } )'
diff --git a/Completion/Mandriva/Command/_rebootin b/Completion/Mandriva/Command/_rebootin
index 1b69609..3f30b25 100644
--- a/Completion/Mandriva/Command/_rebootin
+++ b/Completion/Mandriva/Command/_rebootin
@@ -1,27 +1,29 @@
#compdef rebootin
+local context state line expl
+typeset -A opt_args
local loader=$(sudo detectloader -q)
-_arguments -C -s \
+_arguments -s \
'-n[no immediate reboot just set the flags for next reboot]' \
'-f[create a /fastboot file to reboot in fastboot mode]' \
'*::arguments:->loader_entry'
-local expl
case $state in
- loader_entry)
- case $loader in
- GRUB)
- if [ -r /boot/grub/menu.lst ];then
- compadd ${${(M)${(f)"$(</boot/grub/menu.lst)"}##title *}#title }
- fi
- ;;
- LILO)
- if [ -r /etc/lilo.conf ];then
- compadd $(awk -F= '{ if ($0 ~ /label=/) print $2 }' /etc/lilo.conf)
- fi
- ;;
- *)
- ;;
- esac
+ loader_entry)
+ case $loader in
+ GRUB)
+ if [ -r /boot/grub/menu.lst ]; then
+ _wanted -C $context entries expl entry \
+ compadd ${${(M)${(f)"$(</boot/grub/menu.lst)"}##title *}#title }
+ fi
+ ;;
+ LILO)
+ if [ -r /etc/lilo.conf ]; then
+ _wanted -C $context entries expl entry \
+ compadd $(awk -F= '{ if ($0 ~ /label=/) print $2 }' /etc/lilo.conf)
+ fi
+ ;;
+ esac
+ ;;
esac
diff --git a/Completion/Unix/Type/_directories b/Completion/Unix/Type/_directories
index ab1b50b..702d31d 100644
--- a/Completion/Unix/Type/_directories
+++ b/Completion/Unix/Type/_directories
@@ -1,4 +1,4 @@
-#compdef rmdir df dircmp -P -value-,*path,-default-
+#compdef rmdir dircmp -P -value-,*path,-default-
local expl
diff --git a/Completion/Unix/Type/_pdf b/Completion/Unix/Type/_pdf
index f20f94e..60cee84 100644
--- a/Completion/Unix/Type/_pdf
+++ b/Completion/Unix/Type/_pdf
@@ -1,4 +1,4 @@
-#compdef pdf2dsc pdf2ps pdfimages pdfinfo pdftopbm pdftops pdftotext pdfopt pdffonts kpdf apvlv evince epdfview
+#compdef pdf2dsc pdf2ps pdfimages pdfinfo pdftopbm pdftops pdftotext pdfopt pdffonts kpdf apvlv epdfview
local expl ext=''
diff --git a/Completion/Unix/Type/_pids b/Completion/Unix/Type/_pids
index 3c6a765..cf90005 100644
--- a/Completion/Unix/Type/_pids
+++ b/Completion/Unix/Type/_pids
@@ -1,4 +1,4 @@
-#compdef pflags pcred pmap pldd psig pstack pfiles pwdx pstop prun pwait ptree
+#compdef pflags pcred pmap pldd psig pstack pfiles pwdx pstop prun pwait
# If given the `-m <pattern>' option, this tries to complete only pids
# of processes whose command line match the `<pattern>'.
diff --git a/Completion/openSUSE/Command/_SUSEconfig b/Completion/openSUSE/Command/_SUSEconfig
index d508285..737a80b 100644
--- a/Completion/openSUSE/Command/_SUSEconfig
+++ b/Completion/openSUSE/Command/_SUSEconfig
@@ -1,15 +1,7 @@
#compdef SuSEconfig
-local curcontext="$curcontext" state line
-typeset -A opt_args
-
-if [[ -z "$_SuSEconfig_modules" ]]; then
- for i in /sbin/conf.d/SuSEconfig.*; do
- case $i in *.rpm*|*.swap|*.bak|*.orig|*~|\#*) continue;; esac
- _SuSEconfig_modules=($_SuSEconfig_modules ${i##*/SuSEconfig.})
- done
-fi
-
+local modules
+modules=( /sbin/conf.d/SuSEconfig.*~(*.rpm*|*.swap|*.bak|*.orig|*~|\#*)(N:e) )
_arguments \
'--help' \
@@ -17,12 +9,6 @@ _arguments \
'--force' \
'--verbose' \
'--nonewpackage' \
- '--module:module:->module' && return 0
-
-case $state in
- module) compadd $_SuSEconfig_modules ;;
-esac
-
-# Usage: SuSEconfig [--quick|--nonewpackage|--force|--verbose] [--module name]
-
-
+ '-norestarts' \
+ '-nomodule' \
+ '--module:module:compadd -a modules'
Messages sorted by:
Reverse Date,
Date,
Thread,
Author