zsh-workers
 help / color / mirror / code / Atom feed
From: dana <dana@dana.is>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: [PATCH] Completion: Use -B+ in _du
Date: Wed, 15 Aug 2018 16:13:16 -0500	[thread overview]
Message-ID: <97613F9D-B811-41FC-8F13-AA07C2B3C892@dana.is> (raw)

Just adding + to the -B spec(s) for du.

In case this seems pedantic: The lack of + causes really irritating behaviour
when completing arguments after manually entering the +-less option and its
argument as one word, as in the following case:

  % du -BM /some/incomplete/path/<TAB>
  completing size (bytes):

A quick search of the other completion functions shows 219 matching /-\w\[.*\]:/
and 67 matching /-\w,--[\w-]+=/. Probably not *all* of those are problematic,
but i bet most of them are. I'll try to go through and fix them all (or at least
the ones i'm most familiar with) some other time.

(Unless it's possible to fix it at a lower level? It seems like _arguments could
be made to handle this mis-spec more gracefully, as long as it hasn't been
called with -w/-W. Maybe that's too 'magic' though)

dana


diff --git a/Completion/Unix/Command/_du b/Completion/Unix/Command/_du
index e812b635e..711f43471 100644
--- a/Completion/Unix/Command/_du
+++ b/Completion/Unix/Command/_du
@@ -6,7 +6,7 @@ if _pick_variant gnu=Free\ Soft unix --version /dummy/no-such-file; then
   _arguments -s \
     '(-a --all -s --summarize)'{-a,--all}'[write counts for all files]' \
     '--apparent-size[print apparent sizes rather than disc usage]' \
-    '(-B --block-size -k)'{-B,--block-size=}'[specify block size]:size (bytes)' \
+    '(-B --block-size -k)'{-B+,--block-size=}'[specify block size]:size (bytes)' \
     '(-B --block-size -k --apparent-size -b --bytes)'{-b,--bytes}'[equivalent to --apparent-size --block-size=1]' \
     '(-c --total)'{-c,--total}'[produce a grand total]' \
     '(-H -D --dereference-args -L --dereference -P --no-dereference)'{-H,-D,--dereference-args}'[dereference arguments that are symlinks]' \
@@ -64,7 +64,7 @@ else
     'netbsd*' '-i[output inode usage instead of blocks]' \
     '(darwin*|freebsd*|netbsd*|solaris2.<11->)' '(-h -k -g -B)-m[use block size of 1M-byte]' \
     '(darwin|freebsd<8->.|netbsd)*' '(-h -k -m -B)-g[use block size of 1G-byte]' \
-    'freebsd*' '(-h -k -m -g)-B[block size]:block size (bytes)' \
+    'freebsd*' '(-h -k -m -g)-B+[block size]:block size (bytes)' \
     '(darwin|*bsd|dragonfly)*' '-c[display grand total]' \
     'freebsd*' '-l[count sizes many times if hard linked]' \
     '(freebsd|netbsd)*' '-n[ignore files and directories with nodump flag set]' \


                 reply	other threads:[~2018-08-15 21:13 UTC|newest]

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=97613F9D-B811-41FC-8F13-AA07C2B3C892@dana.is \
    --to=dana@dana.is \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).