zsh-workers
 help / color / mirror / code / Atom feed
* _arguments for non-dashed parameters (or similar)?
@ 2011-12-04 22:51 Richard Hartmann
  2011-12-05  2:03 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Hartmann @ 2011-12-04 22:51 UTC (permalink / raw)
  To: zsh workers

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: _arguments for non-dashed parameters (or similar)?
  2011-12-04 22:51 _arguments for non-dashed parameters (or similar)? Richard Hartmann
@ 2011-12-05  2:03 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2011-12-05  2:03 UTC (permalink / raw)
  To: zsh workers

If I understand the question correctly, "non-dashed parameters" need
to be handled as if the are simple words on the command line ala file
names.  Take a look at the completion function for _cvs, where the
subcommands are handled in _cvs_command.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-12-05  2:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-04 22:51 _arguments for non-dashed parameters (or similar)? Richard Hartmann
2011-12-05  2:03 ` Bart Schaefer

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).