Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] Completion: Use -B+ in _du
- X-seq: zsh-workers 43302
- From: dana <dana@xxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: [PATCH] Completion: Use -B+ in _du
- Date: Wed, 15 Aug 2018 16:13:16 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dana-is.20150623.gappssmtp.com; s=20150623; h=from:content-transfer-encoding:mime-version:subject:message-id:date :to; bh=FNQ0C1LMKip0dEdykTIqDUr6NEaEDkYO+Fuh2zglarw=; b=w35SSodWBpRCmBRpuHMjdivbsLJlZ06TqwoZjaCMiFH4sTY1ZA5bbJUGJRHSD5OA98 wnwQBQXVZH3b6Rtgs+TOkMTocy8CTjx2ODQikDtMInxRdHoNDFiFZrbCIHaanElL85So nDlGzigKA420FM+MeAHuB19WeHWEWOj+N/tIAPffw8YhsM1N3TQzaTX7zCd4wmzM9w32 HwECxG63lA5W96LtCOEP8h54dTBErINaZVxxOtLI/ibqlBymbzuvN0D1GitYena7uKRp A/t/R6zGqxQT43UPU+b86jyVzI9Stsou5p8TD4KoSxUl3+BIRhgcY1bXLAZ29QxZjAR5 Y/kg==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
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]' \
Messages sorted by:
Reverse Date,
Date,
Thread,
Author