zsh-workers
 help / color / mirror / code / Atom feed
* ZSH-Completion help
       [not found] <563731560805071048y62366ca5y2c60030eef9cdd31@mail.gmail.com>
@ 2008-05-07 19:36 ` praful mathur
  0 siblings, 0 replies; only message in thread
From: praful mathur @ 2008-05-07 19:36 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 1921 bytes --]

Hey,

I was wondering if it's possible to append variables such as _host or create
a custom variable in the arguments array. I just need to append :0.0 and
similar things to other variables such as users. I tried to follow:
http://www.linux-mag.com/id/1106
 and I used the state variable but it failed for me. Then I tried to use
something like:
_myhosts=( ${(f)"$(<~/devel/imp_outs/hosts | sed 's/$/:0.0/')"} )
 but that messed up horribly.

Also, I wanted to know how can I create an argument that is a colon
separated value of _users. For example, if I use a certain flag I want to be
able to do something like:
mycommand -userflag user1:user2:user3
 with all the users being tab completed from the _users variable. It should
stop when I enter a space.

Another thing I tried to do was get only one command to tab complete so you
should only complete one command, so the following would be illegal:
mycommand cmd1 cmd1
mycommand cmd1 cmd2

My code is as follows:

> #compdef mycommand
>
> local arguments state
>
> arguments=(
>
> #append :0.0 to this
>  '(-d)-d[set display to display]:display:_hosts'
>
> #if this flag is set, none other should complete
>  '(-h -a -b -d -g -i -k -m -n -p -r -s -v -w -x)-h[prints help message]'
>
> #needs to continue completion from _users after :
> '(-m)-m[email to colon separated value of emails ]:colon separated
> emails:_users'
>
>
> #this errors by showing me files too, not just directories after all
> #directories have been exhausted in the given path
>  '(-p)-p[use PATH as thedirectory]:path:_files -/'


>
> #only one command should complete with mycommand
>  '*:commands:(cmd cmd1 cmd2 cmd3)'
> )
>
>
>
So I'm trying to do these things:
mycommand -h <TAB> (shows nothing)
mycommand cmd1 <TAB> (shows nothing)
mycommand -p <TAB> (show directories)
mycommand -d <TAB> (show all hosts appended with :0.0)
mycommand -m user1:<TAB> (shows all users)
____________
dasickis

[-- Attachment #2: Type: text/html, Size: 4635 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-05-07 19:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <563731560805071048y62366ca5y2c60030eef9cdd31@mail.gmail.com>
2008-05-07 19:36 ` ZSH-Completion help praful mathur

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