Zsh Mailing List Archive
Messages sorted by:
completion for function arguments?
- X-seq: zsh-users 24135
- From: TJ Luoma <luomat@xxxxxxxxx>
- To: Zsh MailingList <zsh-users@xxxxxxx>
- Subject: completion for function arguments?
- Date: Thu, 8 Aug 2019 09:06:47 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=SV+tPuXoROfa/JM3bh85l65rRjy96Wn/XFf2Emhq7FY=; b=TlA4ijHkVBoKgmFGOqlsU0jyTbIGXMEMa5qipNJWzWlnxvwWFtM8EQOAcZctqszwgA yIJUmYLHHji6lblC9xfKRPv6q/nbVBiiRN/IGbbf64MIGoGPfsEtmUepAY2MVUFutnD3 baPeVUV7sJrPO5AWz6DgdpKIzuTm4Nx3BrCpp6I1QFlNbvbaH0R/Jy+PN2Xnjt9XiSuf hRNf+TNZGOyPbERjojiLacTIsxR6gjD+k5CFnn9G5ma7hS4BhBf4snuYlbehW9Bsiaq1 aOXbeOLK66jNoY5QXsjbgeKH2EF80r6rVlXIghxHLbF6V8WRxtoDvmlStZPWVqOh1OwA WYbw==
- List-help: <mailto:firstname.lastname@example.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:email@example.com>
- List-unsubscribe: <mailto:firstname.lastname@example.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
Let me start by saying that I don't understand completion at all, so
this may be a) simple or b) impossible or c) have to be done a
completely different way.
I have a function called 'jump' which I will include below.
The function takes one (1) argument from a specific list of arguments.
I have defined these arguments as part of the function, although they
don't have to be defined that way if there's another way of doing it
that would work better for completion.
Here's what the function looks like now, and then I'll continue my
for ARGS in "$@"
case "$ARGS" in
'Computer - m1 - 6F333BF4-CF2B-4E98-8281-A79667878D40.jump'
FILE='Computer - iMac -
FILE='Computer - Tyrion -
FILE='Computer - MBA -
FILE='Computer - MacMiniColo -
echo " [jump]: Fatal Error! Don't know what to
do with arg: $1"
done # for args
if [[ -f "$JDIR/$FILE" ]]
open -a 'Jump Desktop' "$JDIR/$FILE"
echo "[jump] No file found at '$JDIR/$FILE'."
As you can see, these files are obscurely named in an obscure folder
on my Mac, but I _could_ create links to all of them with the
preferred names, such as
and then all the function would need to do is open the file that
matches the argument.
I'd like to be able to type "jump [tab]" and have all of the options
appear (m1, mini, mba, tyrion, imac) or type "jump m[tab]" and have
just the ones that start with 'm' appear, etc. I think that's all
fairly standard completion stuff.
Any help would be appreciated.
Also, anyone has or knows of a "beginners' step-by-step guide to
understanding completion" please let me know.
Thanks, as always!
Messages sorted by: