help / color / Atom feed
From: Jun T <takimoto-j@kba.biglobe.ne.jp>
To: zsh-workers@zsh.org
Subject: [PATCH] _tar: improve completion of long options
Date: Wed, 18 Sep 2019 18:34:57 +0900
Message-ID: <BA72AA66-3FA4-4A39-B77F-F84457A2F8BA@kba.biglobe.ne.jp> (raw)

_tar does not complete long options in many cases, for example:

tar t --<TAB>
tar tf a.tar --<TAB>
tar -t -f a.tar --<TAR>

In the following workaround, the spec '*: : true' tells _arguments that
't', 'tf' or 'a.tar' in the examples above are legal and do not stop
completion at these "arguments".
The effect of '-f+:' is not to complete long options for
tar -f --<TAB>

diff --git a/Completion/Unix/Command/_tar b/Completion/Unix/Command/_tar
index 727fbd6b5..f9901c0c9 100644
--- a/Completion/Unix/Command/_tar
+++ b/Completion/Unix/Command/_tar
@@ -99,7 +99,7 @@ if [[ "$PREFIX" = --* ]]; then
   # ...long options after `--'.
-  _arguments -- -l '--owner=*:user:_users' \
+  _arguments '-f+:' '-C+:' '*: : true' -- -l '--owner=*:user:_users' \
 		 '--group=*:group:_groups' \
 		 '--atime-preserve*::method:(replace system)' \
 		 '--*-script=NAME:script file:_files' \

                 reply index

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BA72AA66-3FA4-4A39-B77F-F84457A2F8BA@kba.biglobe.ne.jp \
    --to=takimoto-j@kba.biglobe.ne.jp \
    --cc=zsh-workers@zsh.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link


Archives are clonable: git clone --mirror http://inbox.vuxu.org/zsh-workers

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git