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

PATCH: Re: PATCH: update-alternatives completion



> To solve this, we invented the `= ' prefix for _argument actions, i.e.:
> just change the above to `...:= ->install' and so on.

That did the trick.

> By this description I don't know what you mean -- and without anything
> debianish here I can't really try.  But anyway, you'd need some kind of
> loop around the `case...esac' to enable these:
> 
> > +                   '--slave:*::slave:->islave' \
> 
> But of course you know that...

Here's an example of a valid command:

update-alternatives --quiet --install /usr/bin/awk awk /usr/bin/gawk 10 \
  --slave /usr/share/man/man1/awk.1.gz awk.1.gz /usr/share/man/man1/gawk.1.gz \
  --slave /usr/bin/nawk nawk /usr/bin/gawk \
  --slave /usr/share/man/man1/nawk.1.gz nawk.1.gz /usr/share/man/man1/gawk.1.gz

For each --slave, you repeat the <path> <name> <path>.

> Isn't there a better description than `altname'?  Or is this some well
> known, recognised word in the debian world?

No, it's not.  I've changed it to `name' for now, though `alternative name'
would be correct as well, I suppose.

> P.S.: Too late now, but do you really like these mixed underscore/hyphen
>       names?

No, I actually typed _update_alternatives in .distfiles, but of course
that didn't work out well seeing as how the file is named something
else.

> P.P.S.: A command name with 19 characters?  What are we coming to... ;-)

I guess you haven't seen /usr/sbin/upgrade-windowmaker-defaults

Index: Completion/Debian/Command/_dpkg
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Debian/Command/_dpkg,v
retrieving revision 1.2
diff -u -r1.2 _dpkg
--- Completion/Debian/Command/_dpkg	2001/05/28 18:59:03	1.2
+++ Completion/Debian/Command/_dpkg	2001/05/29 12:15:40
@@ -58,7 +58,7 @@
            '--print-architecture[print target architecture]' \
            '--print-gnu-build-architecture[print GNU version of target architecture]' \
            '--print-installation-architecture[print host architecture]' \
-           '--compare-versions[compare version numbers]:*:expression:->compare_versions')
+           '--compare-versions[compare version numbers]:*::expression:= ->compare_versions')
 
 _dpkg_options=('--abort-after[abort after errors]:number of errors:' \
            '--admindir=[data directory]:directory:_files -/' \
Index: Completion/Debian/Command/_update-alternatives
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Debian/Command/_update-alternatives,v
retrieving revision 1.1
diff -u -r1.1 _update-alternatives
--- Completion/Debian/Command/_update-alternatives	2001/05/28 19:06:51	1.1
+++ Completion/Debian/Command/_update-alternatives	2001/05/29 12:15:40
@@ -10,11 +10,11 @@
            '--version' \
            '--altdir:altdir:_files -/' \
            '--admindir:admindir:_files -/' \
-    '--install:*::alt:->install' \
-    '--remove:*::alt:->remove' \
-    '--auto:altname:_files -W /var/lib/dpkg/alternatives' \
-    '--display:altname:_files -W /var/lib/dpkg/alternatives' \
-    '--config:altname:_files -W /var/lib/dpkg/alternatives' && return 0
+    '--install:*::alt:= ->install' \
+    '--remove:*::alt:= ->remove' \
+    '--auto:name:_files -W /var/lib/dpkg/alternatives' \
+    '--display:name:_files -W /var/lib/dpkg/alternatives' \
+    '--config:name:_files -W /var/lib/dpkg/alternatives' && return 0
 
 _call_function ret _update_alternatives_$state && return ret
 case "$state" in
@@ -34,7 +34,7 @@
 
 	remove)
 	_arguments \
-                   '1:altname:_files -W /var/lib/dpkg/alternatives' \
+                   '1:name:_files -W /var/lib/dpkg/alternatives' \
                    '2:path:_files'
 	;;
 



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