Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: completion for a few more coreutils things
- X-seq: zsh-workers 41849
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: PATCH: completion for a few more coreutils things
- Date: Tue, 10 Oct 2017 11:16:00 +0200
- Authentication-results: amavisd4.gkg.net (amavisd-new); dkim=pass (2048-bit key) header.d=yahoo.co.uk
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1507628312; bh=ADdxB9hjd0rRl3WgIoYZvbPavW9+qKPkb2FK5RKdTVE=; h=From:References:To:Subject:Date:From:Subject; b=Z/CpSujydRuDPDULcRHxZ8lGsWgaPm7ZZWgPn/kYbch7y9MKft1+/qxTYRZ9I8hGrZDuMclmLOcFZZjIg7F215k4mSEFVrz/WzATSVq8atDnPhV43hEkLLaN8XOENuMJagSChRQ5+K+lqWSVD6CxtIip9rd9HeIH8XoVi6dKOAmz73OiYq3tT9lJRif1owg5PyywH3XOJbJ7aVaoa1suEe4D0V0+qLrucCFIvSrlLvexND9tTqa/IKe7XPeOIMc2JyeDxEzN3cPD5JFYDyaC7JVGcCy6TEqMxgTWqi0JGotMzFIi/+ZPoxk0dP4kjtpQfhtaSVbqaTcdbRe9yQWnLw==
- In-reply-to: <26A9DD8C-898D-4AF9-B060-B7444CC835DA@kba.biglobe.ne.jp>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <21508.1507328204@thecus.kiddle.eu> <26A9DD8C-898D-4AF9-B060-B7444CC835DA@kba.biglobe.ne.jp>
Jun T wrote:
> The file Completion/Unix/Command/_expand need be renamed because _expand
> already exists in Completion/Base/Completer/_expand.
Oh yes. That'll break things fairly badly, sorry.
expand and unexpand completion have a few things in common so
perhaps the best is just to roll expand completion into _unexpand.
Oliver
diff --git a/Completion/Unix/Command/_unexpand b/Completion/Unix/Command/_unexpand
index d9793ea70..13f6ce835 100644
--- a/Completion/Unix/Command/_unexpand
+++ b/Completion/Unix/Command/_unexpand
@@ -1,26 +1,33 @@
-#compdef unexpand gunexpand
+#compdef unexpand gunexpand expand gexpand
-local all tabs ret=1
+local all tabs
local -a args
all="convert all whitespace, instead of just initial whitespace"
-tabs="use comma separated list of tab positions"
-args=(
- "(--all)-a[$all]"
- "(--tabs)-t+[$tabs]:tablist"
- '*:file:_files'
-)
+tabs="[use comma separated list of tab positions]:list of tab positions"
if _pick_variant gnu="Free Soft" unix --version; then
+ if [[ $service = *un* ]]; then
+ args=(
+ "(-a --help --version)--all[$all]"
+ '(--help --version)--first-only[convert only leading sequences of whitespace]'
+ )
+ else
+ args=(
+ '(-i --initial --help --version)'{-i,--initial}"[don't convert tabs after non blanks]"
+ )
+ fi
+
args+=(
- "(-a)--all[$all]"
- '--first-only[convert only leading sequences of whitespace]'
- "(-t)--tabs=[$tabs]:tablist"
+ "(-t --help --version)--tabs=${tabs}"
'(* -)--help[display usage information]'
- '(* -)--version[output version information]'
+ '(* -)--version[display version information]'
)
+elif [[ $OSTYPE = (*bsd*|dragonfly*|darwin*) ]]; then
+ args=( -A "-*" )
fi
+[[ $service = *un* ]] && args+=( "(--all --help --version)-a[$all]" )
-_arguments -s -S "$args[@]" && ret=0
-
-return ret
+_arguments -s -S "$args[@]" \
+ "(--tabs --help)-t+${tabs}" \
+ '*:file:_files'
Messages sorted by:
Reverse Date,
Date,
Thread,
Author