zsh-workers
 help / color / mirror / code / Atom feed
From: Richard Hartmann <richih.mailinglist@gmail.com>
To: zsh workers <zsh-workers@zsh.org>
Subject: _arguments for non-dashed parameters (or similar)?
Date: Sun, 4 Dec 2011 23:51:13 +0100	[thread overview]
Message-ID: <CAD77+gQd5CfLaAPs4uATSoucQzy3RBBQ_Li-a_HKAmUTzfX4ig@mail.gmail.com> (raw)

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


             reply	other threads:[~2011-12-04 22:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-04 22:51 Richard Hartmann [this message]
2011-12-05  2:03 ` Bart Schaefer

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=CAD77+gQd5CfLaAPs4uATSoucQzy3RBBQ_Li-a_HKAmUTzfX4ig@mail.gmail.com \
    --to=richih.mailinglist@gmail.com \
    --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).