From: dana <dana@dana.is>
To: zsh-workers@zsh.org
Subject: [PATCH] Completion batch #2: Misc. trivial fixes
Date: Wed, 3 Jan 2018 15:29:52 -0600 [thread overview]
Message-ID: <289FC0FD-FDAB-4575-8882-E9F8F3FFE4C5@dana.is> (raw)
Some trivial/miscellaneous changes to existing functions:
1. I fixed a bug in `tr` completion — it wasn't showing the option descriptions
for non-GNU variants.
2. I updated `expand` and `unexpand` completion to account for numeric options
as in `expand -4` (instead of `expand -t4`); most variants support this. I
excluded BusyBox, even though the function doesn't currently make any effort
to check for it, because i plan to gradually add support for BusyBox variants
when it's not too irritating (will show up in later batches).
The changes after this one will be more complex.
dana
diff --git a/Completion/Unix/Command/_tr b/Completion/Unix/Command/_tr
index d244bf875..1cfe1200a 100644
--- a/Completion/Unix/Command/_tr
+++ b/Completion/Unix/Command/_tr
@@ -28,7 +28,7 @@ case $variant in
;|
*)
for k in c d s; do
- args+=( -$k$descr[$k] )
+ args+=( -$k$descr[-$k] )
done
;;
esac
diff --git a/Completion/Unix/Command/_unexpand b/Completion/Unix/Command/_unexpand
index 13f6ce835..b548b3c3a 100644
--- a/Completion/Unix/Command/_unexpand
+++ b/Completion/Unix/Command/_unexpand
@@ -28,6 +28,10 @@ elif [[ $OSTYPE = (*bsd*|dragonfly*|darwin*) ]]; then
fi
[[ $service = *un* ]] && args+=( "(--all --help --version)-a[$all]" )
+# Most (un)expand variants, excluding BusyBox, allow e.g. -4 instead of -t4
+[[ $_cmd_variant[$service] == *busybox* ]] ||
+args+=( '!(-0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -t --tabs)-'{0..9} )
+
_arguments -s -S "$args[@]" \
"(--tabs --help)-t+${tabs}" \
'*:file:_files'
next reply other threads:[~2018-01-03 21:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-03 21:29 dana [this message]
2018-01-03 23:40 ` Oliver Kiddle
2018-01-04 0:03 ` dana
2018-01-04 11:47 ` Oliver Kiddle
2018-01-04 16:05 ` dana
2018-01-06 6:11 ` dana
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=289FC0FD-FDAB-4575-8882-E9F8F3FFE4C5@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).