zsh-workers
 help / color / mirror / code / Atom feed
From: "praful mathur" <dasickis@gmail.com>
To: zsh-workers@sunsite.dk
Subject: ZSH-Completion help
Date: Wed, 7 May 2008 15:36:11 -0400	[thread overview]
Message-ID: <563731560805071236i57041329v9585b8d7c9c0e1d8@mail.gmail.com> (raw)
In-Reply-To: <563731560805071048y62366ca5y2c60030eef9cdd31@mail.gmail.com>

[-- 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 --]

           reply	other threads:[~2008-05-07 19:36 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <563731560805071048y62366ca5y2c60030eef9cdd31@mail.gmail.com>]

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=563731560805071236i57041329v9585b8d7c9c0e1d8@mail.gmail.com \
    --to=dasickis@gmail.com \
    --cc=zsh-workers@sunsite.dk \
    /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).