From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 9330 invoked from network); 27 Aug 2021 11:59:16 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 27 Aug 2021 11:59:16 -0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Message-ID:Date:Content-ID: Content-Type:MIME-Version:Subject:To:From:Reply-To:Cc: Content-Transfer-Encoding:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References; bh=UpMgGbDY785OfmRDQyWXB4Dow2sNK5yMTGHUqG/ieQ8=; b=AyE2DmBHkwFQ9cC61x0tFmzQEJ fK+5A4bry8W9a7K/U6j+v/DX7LxgnzxRGyiey5XqXbGi92bFvzLywzC1vVkEGJGoGK9jPXQ67yDcF 2vUmq98J9WxmvbhS0EKaFKGWrFIUuEt5W+/56C9AtRS95IpRo28Z2YAdpAOtYshO27keUIX3TFKdY S7Ln683kgLpt0m6YarvgzSgnSC88YarAGykm6iiw5VRvUfQ/EMQLpnb3piRBl3BmDGxa/ZpecO8Z4 PsGJnWuIQJBD3onY5MbaKLQXE7+seJgcDttDEDXjbLT5375fJSZaqJ7YzjBXiKggqWvBdle/XoF4V KeTo+rNw==; Received: from authenticated user by zero.zsh.org with local id 1mJaVv-00094I-R7; Fri, 27 Aug 2021 11:59:15 +0000 Received: from authenticated user by zero.zsh.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1mJaVj-0008lx-V3; Fri, 27 Aug 2021 11:59:04 +0000 Received: from [192.168.178.21] (helo=hydra) by mail.kiddle.eu with esmtp(Exim 4.94.2) (envelope-from ) id 1mJaVj-000JDe-IT for zsh-workers@zsh.org; Fri, 27 Aug 2021 13:59:03 +0200 From: Oliver Kiddle To: Zsh workers Subject: PATCH: add (-.) glob qualifier to globs where only files are directly applicable MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <73880.1630065543.1@hydra> Date: Fri, 27 Aug 2021 13:59:03 +0200 Message-ID: <73881-1630065543.570004@r-2U.UMNg.El_B> X-Seq: 49316 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: This was previously done en-masse in 19387 but a few cases have sneaked past review since. I still ponder whether we should have redefined _files at the time instead to keep the common case easier. -g "*" also triggered my recursive grep and is pointless. And there's a case where we can use the _pdf helper. Oliver diff --git Completion/Unix/Command/_bittorrent Completion/Unix/Command/_bittorrent index 1f305a1c0..1fbab35ef 100644 --- Completion/Unix/Command/_bittorrent +++ Completion/Unix/Command/_bittorrent @@ -69,7 +69,7 @@ case $service in '--piece_size_pow2+[specify power of 2 to set the piece size to]:power:' \ "--comment+[specify human-readable comment to put in .torrent]:comment:"\ "--target+[specify target file for the torrent]:file:_files"\ - ':file:_files -g "*"' + ':file:_files' return ;; diff --git Completion/Unix/Command/_go Completion/Unix/Command/_go index 30a2bf88f..0b4b16dfa 100644 --- Completion/Unix/Command/_go +++ Completion/Unix/Command/_go @@ -15,4 +15,4 @@ case $service in ;; esac -_wanted files expl "input file" _files -g "$pat" +_wanted files expl "input file" _files -g "$pat(-.)" diff --git Completion/Unix/Command/_pandoc Completion/Unix/Command/_pandoc index e694606c0..464859655 100644 --- Completion/Unix/Command/_pandoc +++ Completion/Unix/Command/_pandoc @@ -67,7 +67,7 @@ _pandoc_template(){ local format=${${(v)opt_args[(i)(-t|--to|-w|--write)]}%%(+|-)*} [[ -z $format ]] && format=${(v)opt_args[(i)(-o|--output)]:e} local pat="'*'" # or '*.*' ? - [[ -n $format ]] && pat="'*.$format'" + [[ -n $format ]] && pat="'*.$format(-.)'" local template_dir=$(_pandoc_default_dir)/templates _alternative \ "local-templates:local template:_files -g $pat" \ @@ -80,7 +80,7 @@ _pandoc_template(){ _pandoc_highlight_style(){ _alternative \ 'styles:style:( $(pandoc --list-highlight-styles) )' \ - 'style-files:style file:_files -g "*.theme"' + 'style-files:style file:_files -g "*.theme(-.)"' } # filter file in $PWD, data-dir/filters/ or $PATH @@ -98,8 +98,8 @@ _pandoc_filter(){ _pandoc_lua_filter(){ local filters_dir=$(_pandoc_default_dir)/filters _alternative \ - 'local-filters:local filter:_files -g "*.lua"' \ - 'data-dir-filters:filter in data-dir:_files -W filters_dir -g "*.lua"' + 'local-filters:local filter:_files -g "*.lua(-.)"' \ + 'data-dir-filters:filter in data-dir:_files -W filters_dir -g "*.lua(-.)"' } # default file in $PWD or data-dir/defaults/ @@ -107,8 +107,8 @@ _pandoc_lua_filter(){ _pandoc_defaults_file() { local defaults_dir=$(_pandoc_default_dir)/defaults _alternative \ - 'local-defaults:default file:_files -g "*.yaml"' \ - 'data-dir-defaults:default in data-dir:_files -W defaults_dir -g "*.yaml"' + 'local-defaults:default file:_files -g "*.yaml(-.)"' \ + 'data-dir-defaults:default in data-dir:_files -W defaults_dir -g "*.yaml(-.)"' } # choose reference location @@ -214,7 +214,7 @@ _arguments -s \ '--no-highlight[disables syntax highlighting for code blocks and inlines]' \ '--highlight-style=[specifies the coloring style to be used in highlighted source code]:style|file:_pandoc_highlight_style' \ '(- :)--print-highlight-style=[prints a JSON version of a highlighting style]: :_pandoc_highlight_style' \ - '--syntax-definition=[load a KDE XML syntax definition file]:file:{_files -g "*.xml"}' \ + '--syntax-definition=[load a KDE XML syntax definition file]:file:_files -g "*.xml(-.)"' \ {\*-H+,\*--include-in-header=}'[include contents of FILE, verbatim, at the end of the header, implies --standalone]:file:_files' \ {\*-B+,\*--include-before-body=}'[include contents of FILE, verbatim, at the beginning of the document body, implies --standalone]:file:_files' \ {\*-A+,\*--include-end-body=}'[include contents of FILE, verbatim, at the end of the document body, implies --standalone]:file:_files' \ @@ -242,14 +242,14 @@ _arguments -s \ '--reference-doc=[use the specified file as a style reference in producing a docx or ODT file]:file: ' \ '--epub-subdirectory=[specify the subdirectory in the OCF container that is to hold the EPUB-specific contents]:directory:_files -/' \ '--epub-cover-image=[use the specified image as the EPUB cover]:file:_files' \ - '--epub-metadata=[look in the specified XML file for metadata for the EPUB]:file:{_files -g "*.xml"}' \ + '--epub-metadata=[look in the specified XML file for metadata for the EPUB]:file:_files -g "*.xml(-.)"' \ '*--epub-embed-font=[embed the specified font in the EPUB]:file:_files ' \ '--epub-chapter-level=[specify the header level at which to split the EPUB into separate "chapter" files]:number:(1 2 3 4 5 6)' \ '--ipynb-output=[specify how to tread ipynb output cells]:method:(all none best)' \ '--pdf-engine=[use the specified engine when producing PDF output]:program:_pandoc_pdf_engine' \ '*--pdf-engine-opt=[use the given string as a command-line argument to the pdf-engine]:string:_pandoc_pdf_engine_opts' \ - '*--bibliography=[set the bibliography field in the document'"'"'s metadata to FILE]:file:{_files -g "*.(bib|bibtex|copac|json|yaml|enl|xml|wos|medline|mods|ris)"}' \ - '--csl=[set the csl field in the document'"'"'s metadata to FILE]:file:{_files -g "*.csl"}' \ + "*--bibliography=[set the bibliography field in the document's metadata to specified file]:file:_files -g '*.(bib|bibtex|copac|json|yaml|enl|xml|wos|medline|mods|ris)(-.)'" \ + "--csl=[set the csl field in the document's metadata to specified file]:file:_files -g '*.csl(-.)'" \ '--citation-abbreviations=[set the citation-abbreviations field in the document'"'"'s metadata to FILE]:file:_files' \ '--natbib[use natbib for citations in LaTeX output]' \ '--biblatex[use biblatex for citations in LaTeX output]' \ diff --git Completion/Unix/Command/_transmission Completion/Unix/Command/_transmission index c060cbae3..9b7309fe2 100644 --- Completion/Unix/Command/_transmission +++ Completion/Unix/Command/_transmission @@ -114,7 +114,7 @@ _transmission-remote_days(){ (( $+functions[_transmission-remote_add] )) || _transmission-remote_add(){ _alternative \ - 'args:torrent:_files -g ".torrent"' \ + 'args:torrent:_files -g ".torrent(-.)"' \ 'args:url:_urls' } # complete torrents diff --git Completion/X/Command/_pdftk Completion/X/Command/_pdftk index 1ac3223f7..b26deb15f 100644 --- Completion/X/Command/_pdftk +++ Completion/X/Command/_pdftk @@ -34,13 +34,11 @@ case $words[CURRENT-1] in ;; (fill_form) - _description files expl 'FDF and XFDF file' - _files "$@" $expl -g '(#i)*.(fdf|xfdf)' + _wanted files expl 'FDF or XFDF file' _files -g '(#i)*.(fdf|xfdf)(-.)' ;; ((multibackground|background|stamp|multistamp|output)) - _description files expl 'PDF file' - _files "$@" $expl -g '(#i)*.pdf' + _pdf ;; (update_info)