Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: completion implementation woes
- X-seq: zsh-users 21998
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Roman Neuhauser <neuhauser@xxxxxxxxxx>
- Subject: Re: completion implementation woes
- Date: Sun, 02 Oct 2016 03:31:54 +0200
- Cc: zsh-users@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1475371915; bh=EXlVdb6Fn9omwpAKlgzCKiaSuKwjpwvjhVmcI3eHR6E=; h=cc:In-reply-to:From:References:To:Subject:Date:From:Subject; b=qF17OMC8K7PAIdw3Kng6+L8zBTnWi7LujeFFAkIbAXT7U/+h1cKFsygbeNjBwl9ar/UIyuEp9jEVaxtb4AdnKgprvce8V5CSFGU8r5/GixYYShDicFm16f81nfLabsRNsYm27QVQo2hmZd2u4gznlBl4i/MgIowK7ubpul1u4IQWiEKu0al1eQvyM3PZfVJRuln9J9FR/Dohs7oquKBy7d+8swkAMrlLudRoHLZ2IP1+dqjsxcSos/me9asKliwMQl2ekRL4Z0+cr0idT7v1TlFSNvtvGmRG4NYERD4rzbYkLMqy/F2e8wQ8PT5KkTvzd2LVfWYUYj0N+M0vGrNR7Q==
- In-reply-to: <20161002001931.GA686081@isis.sigpipe.cz>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <20161002001931.GA686081@isis.sigpipe.cz>
Roman Neuhauser wrote:
> i have difficult time with completion for a git subcommand i wrote,
> and would appreciate a little help.
> _git-dirs-_args \
> - '(help)' \
> '-h[display usage]' \
> '--help[display man page]' \
> - 'command' \
> ":command:_git-dirs-_verb" \
> "*:option or operand:_git-dirs-_verb-arg"
You'll find it solves quite a few of your issues if you change this to
the two colon form:
"*::option or operand:_git-dirs-_verb-arg"
When handling subcommands, it is important to drop initial arguments
from the beginning of $words to avoid confusing later calls to
_arguments. If $words contains ( git dirs init ), _arguments sees a
command and two arguments. That's what _arguments called from _git
wants but not good from _git_dirs-init.
Getting rid of the sets in _git-dirs fixes completion after git
dirs init -N. Somehow it isn't getting past the first _arguments. --help
style options can usually just be given an exclusion list of (- :)
Oliver
Messages sorted by:
Reverse Date,
Date,
Thread,
Author