zsh-users
 help / color / mirror / code / Atom feed
From: Andy Spiegl <zsh.Andy@spiegl.de>
To: zsh-users@sunsite.dk
Subject: Re: dynamic file completion
Date: Tue, 21 Mar 2006 17:35:52 +0100	[thread overview]
Message-ID: <20060321163552.GA20449@spiegl.de> (raw)
In-Reply-To: <EXCHANGE03ekWo76Uai0000103c@exchange03.csr.com>

Peter Stephenson wrote:

> You need the -W argument to _files; I'd suggest using "_path_files -W
> <dir>", since going directly to _path_files removes some smart behaviour
> in _files you don't want in this case.
Great, that works!  I don't even need the extra file _cridfiles anymore!

> So you need to use your specific directory, but override it if there's a
> --dir.  You'll need to check if there's a --dir on the command line
> already and grab it's argument.  You need something like:
Wonderful, I always loved zsh!  :-)

But _path_files seems to have a problem with paths with ~ in it.
This works:
 gigaset --dir /home/spiegl/movies/gigaset/PVR ls <TAB>
but this doesn't:
 gigaset --dir ~/movies/gigaset/PVR ls <TAB>
Can that be done too?

Ah, neither does this work:
 gigaset --dir $HOME/movies/gigaset/PVR ls <TAB>

Thanks,
 Andy.


Okay, here's what I wrote so far:
-------------------------------------------------
#compdef gigaset

local dir=${words[(r)--dir=*]##--dir=}
if [[ -z $dir ]]; then
  integer dirind=${words[(i)--dir]}
  if (( dirind )); then
    dir=$words[dirind+1]
  fi
fi
if [[ -z $dir ]]; then
  dir="/data/movies/gigaset/PVR/"
fi

_arguments \
   '(--help --usage)'{--help,--usage}'[Hilfestellung anzeigen]' \
   '--version[Programmversion anzeigen]' \
   '--manpage[komplette Manpage aufrufen]' \
   '--debug[Debugmodus aktivieren, mehrfach benutzbar]' \
   '(--dir --criddir)'{--dir=,--criddir=}'[Verzeichnis mit den Aufnahmen und crid-Dateien]:criddir:_path_files -/' \
   '--exportdir=[Verzeichnis für den TS-Export der Aufnahmen]:exportdir:_path_files -/' \
   '--cutdir=[Verzeichnis mit den fertig geschnittenen (noch nicht gemuxten) Filmen]:cutdir:_path_files -/' \
   '--mpgdir=[Verzeichnis mit den fertig geschnittenen und gemuxten MPG-Filmen]:mpgdir:_path_files -/' \
   '(--yes --ja)'{--yes,--ja}'[Keine Sicherheitsabfragen, immer ja antworten]' \
   '--nowarnings[Warnungen unterdrücken]' \
   '(--dontdel --nodel)'{--dontdel,--nodel}'[Temporäre Dateien nicht löschen]' \
   '(--force --overwrite)'{--force,--overwrite}'[vorhandene Dateien überschreiben]' \
   '(--nocolor --nc)'{--nocolor,--nc}'[monochrome Ausgabe]' \
   '(--alang --audiolang)'{--alang=,--audiolang=}'[Audio-Sprache einstellen, z.B. -alang deu,fra]:alang:(deu fra en spa it)' \
   '--search=[Beschränkung auf Aufnahmen mit dem Suchstring]:string:' \
   '--commands[Liste aller Kommandos]' \
   ':cmds: compadd ${${(f)"$(gigaset --commands)"}%%[[:space:]]##--*}' \
   '*:cridfiles:_path_files -W $dir -g "*.crid"'

-------------------------------------------------

-- 
 Your mouse has moved. Windows must be restarted for the change
 to take effect. Reboot now?


      reply	other threads:[~2006-03-21 16:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-17 17:03 Andy Spiegl
2006-03-17 17:34 ` Peter Stephenson
2006-03-21 16:35   ` Andy Spiegl [this message]

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=20060321163552.GA20449@spiegl.de \
    --to=zsh.andy@spiegl.de \
    --cc=zsh-users@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).