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

PATCH: _rpm tweaks (_files vs _path_files discussion)



Now people may disagree with this, but I would have thought that in
many completion scenarios, _path_files -/ -g <glob> is more
appropriate than _files -g <glob>.  For example, when completing tar
archives, if there are none in directory foo, and you type 

  % tar zxf foo/<TAB>

getting a list of all files in the directory is fairly undesirable,
no?

Another case is completing *.spec and *.rpm files with _rpm, which
irritated me enough to provide a patch :-)

It's a matter of taste I suppose, but I'd be interested to hear
whether I'm alone on this.

Index: Completion/Linux/_rpm
diff -u Completion/Linux/_rpm:1.1.1.2 Completion/Linux/_rpm:1.2
--- Completion/Linux/_rpm:1.1.1.2	Thu Sep 16 12:39:44 1999
+++ Completion/Linux/_rpm	Thu Sep 16 13:00:22 1999
@@ -148,7 +148,7 @@
       '*:RPM package:->package' && ret=0
     ;;
   build_b)
-    tmp=( '*:spec file:_files -g \*.spec' )
+    tmp=( '*:spec file:_path_files -/ -g \*.spec' )
     ;&
   build_t)
     (( $#tmp )) || tmp=( '*:tar file:_files -g \*.\(\#i\)tar\(.\*\|\)' )
@@ -195,7 +195,7 @@
       _hosts -S/ && ret=0
     else
       _description expl 'RPM package file'
-      _files "$expl[@]" -g '*.(#i)rpm' && ret=0
+      _path_files "$expl[@]" -/ -g '*.(#i)rpm' && ret=0
       _description expl 'ftp URL prefix'
       compadd "$expl[@]" ftp://
     fi



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