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

Re: 'zcat -f' completion should not filter based on file extension.



On Mon, 27 May 2013 16:45:29 -0400
Evan Teitelman <teitelmanevan@xxxxxxxxx> wrote:
> zcat's completion script only matches files with '.gz' extensions. The
> '-f' flag should cause zcat's completion script to stop filtering
> completion matches based on their extensions. According to the gzip
> manpage, zcat is able to accept and print non-gzip files when passed
> '-f'.

diff --git a/Completion/Unix/Command/_gzip b/Completion/Unix/Command/_gzip
index 5c88fac..a90f232 100644
--- a/Completion/Unix/Command/_gzip
+++ b/Completion/Unix/Command/_gzip
@@ -82,7 +82,11 @@ files)
       _files "$expl[@]" -g '^*.(([tT]|)[gG]|)[zZ](-.)' && return
     else
       _description files expl 'compressed file'
-      _files "$expl[@]" -g '*.(([tT]|)[gG]|)[zZ](-.)' && return
+      if (( $+opt_args[-f] )); then
+	_files "$expl[@]" && return
+      else
+	_files "$expl[@]" -g '*.(([tT]|)[gG]|)[zZ](-.)' && return
+      fi
     fi
   fi
   ;;

-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



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