From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18135 invoked by alias); 13 Jul 2017 09:26:09 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 41414 Received: (qmail 27964 invoked from network); 13 Jul 2017 09:26:09 -0000 X-Qmail-Scanner-Diagnostics: from sirius.uberspace.de by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(95.143.172.236):SA:0(0.0/5.0):. Processed in 1.825138 secs); 13 Jul 2017 09:26:09 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: fabian@kloetzl.info X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at kloetzl.info does not designate permitted sender hosts) To: zsh-workers@zsh.org From: =?UTF-8?Q?Fabian_Kl=c3=b6tzl?= Subject: [PATCH] multiple small completion issues Message-ID: <46f5d9a9-45cb-0b82-1ae6-71ccc52b151d@kloetzl.info> Date: Thu, 13 Jul 2017 11:19:14 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------8F8286DCCDD6DA0593536F87" Content-Language: en-SG --------------8F8286DCCDD6DA0593536F87 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Hi all, As a follow-up to 40808, I have since refined my regex and found the same issue in _iptables. I also realised that people were probably doing this wrong, because that is the way it's documented. Furthermore, I fixed a tiny issue in _gcc (missing escape \) and added the --no-index option for git diff. Patches to all issues are attached. Best, Fabian --------------8F8286DCCDD6DA0593536F87 Content-Type: text/x-patch; name="_gcc.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="_gcc.patch" diff --git a/Completion/Unix/Command/_gcc b/Completion/Unix/Command/_gcc index e188c7e9f..28a2ccbda 100644 --- a/Completion/Unix/Command/_gcc +++ b/Completion/Unix/Command/_gcc @@ -428,7 +428,7 @@ args+=( '-Wdisabled-optimization[Warn when an optimization pass is disabled]' '-Wdiv-by-zero[Warn about compile-time integer division by zero]' '-Wdouble-promotion[Warn about implicit conversions from "float" to "double"]' - '-Weffc++[Warn about violations of Effective C++ style rules]' + '-Weffc\+\+[Warn about violations of Effective C++ style rules]' '-Wempty-body[Warn about an empty body in an if or else statement]' '-Wendif-labels[Warn about stray tokens after #elif and #endif]' '-Wenum-compare[Warn about comparison of different enum types]' --------------8F8286DCCDD6DA0593536F87 Content-Type: text/x-patch; name="_git.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="_git.patch" diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index f764daf75..ba535cede 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -752,7 +752,8 @@ _git-diff () { $diff_options \ '(--exit-code)--quiet[disable all output]' \ $diff_stage_options \ - '(--cached --staged)'{--cached,--staged}'[show diff between index and named commit]' \ + '(--cached --staged)--no-index[show diff between two paths on the filesystem]' \ + '(--cached --staged --no-index)'{--cached,--staged}'[show diff between index and named commit]' \ '(-)--[start file arguments]' \ '*:: :->from-to-file' && ret=0 @@ -770,6 +771,12 @@ _git-diff () { return ret fi + # If "--no-index" was given, only file paths need to be completed. + if [[ -n ${opt_args[(I)--no-index]} ]]; then + _alternative 'files::_files' && ret=0 + return ret + fi + # Otherwise, more complex conditions need to be checked. case $CURRENT in (1) --------------8F8286DCCDD6DA0593536F87 Content-Type: text/x-patch; name="guide.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="guide.patch" diff --git a/Etc/completion-style-guide b/Etc/completion-style-guide index e91e92307..a6fc737a7 100644 --- a/Etc/completion-style-guide +++ b/Etc/completion-style-guide @@ -64,7 +64,7 @@ tells _wanted where to put options specifying the `directory' description. Where two matches have identical meaning, give them the same description so that the completion system can group them together. Conventionally a brace expansion of this form is used: - '(--context,-C)'{--context=,-C-}'[specify lines of context]:lines' + '(--context -C)'{--context=,-C-}'[specify lines of context]:lines' You won't need the exclusion list if the option can be specified multiple times. It can also be useful to use the same description for matches which are completely opposite in their meaning if it shortens --------------8F8286DCCDD6DA0593536F87 Content-Type: text/x-patch; name="_iptables.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="_iptables.patch" diff --git a/Completion/Linux/Command/_iptables b/Completion/Linux/Command/_iptables index 8f990030c..4178a1a2e 100644 --- a/Completion/Linux/Command/_iptables +++ b/Completion/Linux/Command/_iptables @@ -47,7 +47,7 @@ case ${prev[${prev[(I)-p|--protocol]}+1]}; in esac case ${prev[${prev[(I)-j|--jump]}+1]}; in - DNAT) args+=( '(--to,--to-destination)'{--to,--to-destination}':address:_users-ports' ) ;; + DNAT) args+=( '(--to --to-destination)'{--to,--to-destination}':address:_users-ports' ) ;; DSCP) args+=( '--set-dscp[set the DSCP field]:value' @@ -67,7 +67,7 @@ case ${prev[${prev[(I)-j|--jump]}+1]}; in MARK) args+=( '--set-mark[set fwmark in packet]:number' ) ;; REDIRECT|MASQUERADE) args+=( '--to-ports[port (range) to map to]:port range:_ports' ) ;; REJECT) args+=( '--reject-with[drop packet and send reply]:reject type:->reject-types' ) ;; - SNAT) args+=( '(--to,--to-source)*'{--to,--to-source}'[specify address to map source to]:address:_users-ports' ) ;; + SNAT) args+=( '(--to --to-source)*'{--to,--to-source}'[specify address to map source to]:address:_users-ports' ) ;; TCPMSS) args+=( '--set-mss[explicitly set MSS option]:value' --------------8F8286DCCDD6DA0593536F87--