Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
_arguments for non-dashed parameters (or similar)?
- X-seq: zsh-workers 29942
- From: Richard Hartmann <richih.mailinglist@xxxxxxxxx>
- To: zsh workers <zsh-workers@xxxxxxx>
- Subject: _arguments for non-dashed parameters (or similar)?
- Date: Sun, 4 Dec 2011 23:51:13 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; bh=pApQvjSlNAfa27A5xp8Okk2uOn4V6w5J5qsHKYZVC+4=; b=xgaRoXDAQPJ5zyO+jcuVLKZ2E7uX2txz02TDcITuJJSjM0qMOmwtkmDB3zR+dSALB/ bAXqQXQ/fVQIKp0B0hFFZ0Tx2rRUILakP/Rwtn3Vit7qcPYzZHBM17FnfCeItNNKlN1D YTpa9Iv+jmbZQMAm3n14bWcEUamWvjmW0LRMo=
- 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
Hi all,
I am trying to extend my completion for vcsh[1] before I actually
submit it to this list.
The problem is that this syntax simply ignores completion functions
which would feed data into the completion:
#compdef vcsh
_arguments \ ':subcommand:(( clone\:"clone from repo":(1
2) help\:"display help" delete\:"delete repo" enter\:"Enter repo;
spawn new \$SHELL" init\:"init & clone from repo" list\:"list all
repos" list-tracked\:"list all files tracked by
vcsh" list-tracked-by\:"list files tracked by a
repo" rename\:"rename repo" run\:"run command on
repo" seed-gitignore\:"seed .gitignore.d/foo from git
ls-files" setup\:"set up repo with recommended
settings" \<REPO\>\:"Run git command directly" ))'
whereas this syntax does not seem to allow non-dashed parameters:
_arguments \
'-clone:clone from repo:(1 2)' \
'help:"display help"' \
'delete:"delete repo"' \
'enter:"Enter repo; spawn new \$SHELL"' \
'init:"init & clone from repo"' \
'list:"list all repos"' \
'list-tracked:"list all files tracked by vcsh"' \
'list-tracked-by:"list files tracked by a repo"' \
'rename:"rename repo"' \
'run:"run command on repo"' \
'seed-gitignore:"seed .gitignore.d/foo from git ls-files":(foo bar)' \
'setup:"set up repo with recommended settings"' \
'\<REPO\>:"Run git command directly"' \
% vcsh <tab>
_arguments:comparguments:312: invalid argument: clone:clone from repo:(1 2)
%
and this approach does not work, either:
clone[:argargs]:(1 2)
_arguments:comparguments:312: invalid argument: clone[clone from repo]:(1 2)
_git, _subversion et all seem to simply check the non-dashed parameter
by hand and then do the rest in custom functions.
Is there any generic and clean way to do this? If there is not, would
it be worthwhile to introduce a new function? Given the fact that more
and more programs use non-dashed prosaic command styles, this
"problem" is becoming worse, not better.
Richard
[1] https://github.com/RichiH/vcsh
Messages sorted by:
Reverse Date,
Date,
Thread,
Author