From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27497 invoked by alias); 7 Oct 2017 01:23:46 -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: 41825 Received: (qmail 2788 invoked by uid 1010); 7 Oct 2017 01:23:46 -0000 X-Qmail-Scanner-Diagnostics: from out1-smtp.messagingengine.com 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(66.111.4.25):SA:0(-2.6/5.0):. Processed in 2.015908 secs); 07 Oct 2017 01:23:46 -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=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=content-type:date:from:message-id :mime-version:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=fm1; bh=eLwKSXJfERTNRKXtgCdC0LwNc2+UHrj9aYXj6jEPa Bg=; b=YOdB+X6ymUMFIASJPSyHJdv0WmHHdCFBrU8zigkH5No2oPJ5oTFCrt8dI 65Q+SNEl1EJADgyAXiWc8Xc69lcyuKMfQSqnfzWYBAWnPEpOslGtYC6AzSOpHFdV s7nhgZ/St8KYiz0eFQoYbBNm4cHeQnsfmHjfvbResiokjIQIYx+Am6bim/5PNId0 LC4oYOwPSj8ERO1fMWYyp4+7pNGKVuGsf06Z1SoZIjDpehC4c+bWJvqrNnpw3Y6q +W8oYa81nkcjvOHadRNkkU5f4gfHvH0xhj9BbbStVFmQyGO85RsOprytvXpVZP2O PPuClrDsenBLIYrZ4yx/b0xqCTdNA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:message-id :mime-version:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=fm1; bh=eLwKSXJfERTNRKXtgCdC0LwNc2+UHrj9aYXj6jEPa Bg=; b=ecWhu+Y72OUyzeK0QQYnBMOa6rUNJoVrtYpdrsBOMLvUiudkKWDvgFii4 UMSDrPq/S5N8t49LOLYmFoTBzWPd6qtX+4PS2v1PTX/t1FxbmnApq9IppGhAMPB3 Sr17oLXlZfHN8JV+/MvijEZCFHmifqxkdFAhiw1Bp9Ipx+qSzk0STg1XvKBUFy5u +dxAq83U2zCWp2TEg38YmP/O5BwQTyeQzADNJDlvY90+wIz+Cw6ESRGWoEjD9ZAk YZan7jfjdaji7wq0KjV7mZnkegiq6XVPWgaLgFjHsbDpTlGiT7VlihA2vcXz13XZ g6p9iD2OgFFy6t99+3utVCsTMt8lg== X-ME-Sender: X-Sasl-enc: M0HFqGeWqejGPBgU7ZOWTy7YcAhEqHPecuhriChMxh5g 1507339418 Date: Sat, 7 Oct 2017 01:23:36 +0000 From: Daniel Shahaf To: zsh-workers@zsh.org Subject: [PATCH] zstat completion Message-ID: <20171007012336.frc5xayijcypbfat@tarpaulin.shahaf.local2> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="xlsijorhrbavojqi" Content-Disposition: inline User-Agent: NeoMutt/20170113 (1.7.2) --xlsijorhrbavojqi Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Attached. It's relying on the auto-description style for -F. Thanks, Daniel --xlsijorhrbavojqi Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-_stat-Only-complete-stat-if-it-s-provided-by-the-zsh.patch" >>From 0fe0101f5c13fc12e05e9687d0553518c85f1956 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Sat, 7 Oct 2017 00:27:01 +0000 Subject: [PATCH 1/2] _stat: Only complete 'stat' if it's provided by the zsh/stat builtin. --- Completion/Zsh/Command/_stat | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Completion/Zsh/Command/_stat b/Completion/Zsh/Command/_stat index 03e42e3af..303775b23 100644 --- a/Completion/Zsh/Command/_stat +++ b/Completion/Zsh/Command/_stat @@ -4,7 +4,10 @@ local expl ret=1 if [[ "$words[CURRENT-1]" = -[AH] ]]; then _arrays -else +elif [[ $service == zstat ]] || + (( ${+builtins[stat]} )) || + { (( ! ${+builtins} )) && [[ $(type -w stat) == '*: builtin' ]] } +then _tags files options || return 1 while _tags; do @@ -17,4 +20,8 @@ else +size +atime +mtime +ctime +blksize +block +link (( ret )) || return 0 done +else + # TODO: system-specific completion + # TODO: choose this codepath if 'command stat ...' or '=stat ...' is used + _files fi --xlsijorhrbavojqi Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0002-_stat-Complete-x-options-to-zsh-stat-s-zstat.patch" >>From a86ef493ad526dce91a24c3005de089e200f0d81 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Sat, 7 Oct 2017 01:03:18 +0000 Subject: [PATCH 2/2] _stat: Complete -x options to zsh/stat's 'zstat'. --- Completion/Zsh/Command/_stat | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/Completion/Zsh/Command/_stat b/Completion/Zsh/Command/_stat index 303775b23..73bbef471 100644 --- a/Completion/Zsh/Command/_stat +++ b/Completion/Zsh/Command/_stat @@ -2,24 +2,30 @@ local expl ret=1 -if [[ "$words[CURRENT-1]" = -[AH] ]]; then - _arrays -elif [[ $service == zstat ]] || +if [[ $service == zstat ]] || (( ${+builtins[stat]} )) || { (( ! ${+builtins} )) && [[ $(type -w stat) == '*: builtin' ]] } then - _tags files options || return 1 - - while _tags; do - _requested files && _files && ret=0 - _requested options && - { ! zstyle -T ":completion:${curcontext}:options" prefix-needed || - [[ "$PREFIX[1]" = + || ret -eq 1 ]] } && - _all_labels options expl 'inode element' \ - compadd - +device +inode +mode +nlink +uid +gid +rdev \ - +size +atime +mtime +ctime +blksize +block +link - (( ret )) || return 0 - done + _arguments -s -S : \ + '(-H)-A[assign the results to array, don'\''t print]:array variable:_parameters -g "*array*"' \ + - set1 \ + +device +inode +mode +nlink +uid +gid +rdev \ + +size +atime +mtime +ctime +blksize +block +link \ + '(-A)-H[assign the results to associative array, don'\''t print]:associative array variable:_parameters -g "*association*"' \ + '(:)-f[stat a file descriptor]:file descriptor:_file_descriptors' \ + '(-s)-F:strftime(3) format string:_date_formats zsh' \ + '(-s)-g[show times in GMT/UTC]' \ + '-L[don'\''t dereference symbolic links; use lstat(2)]' \ + '(-N)-n[always show names of files]' \ + '(-n)-N[never show names of files]' \ + '-o[print file modes in octal rather than decimal]' \ + '-r[print raw data]' \ + '-s[print mode,uid,gid and times as strings]' \ + '(-T)-t[always show type names]' \ + '(-t)-T[never show type names]' \ + '*:files to stat:_files' \ + - set2 \ + '-l[list stat types]' else # TODO: system-specific completion # TODO: choose this codepath if 'command stat ...' or '=stat ...' is used --xlsijorhrbavojqi--