From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id c33b3ae3 for ; Thu, 8 Aug 2019 13:08:07 +0000 (UTC) Received: (qmail 28406 invoked by alias); 8 Aug 2019 13:08:00 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 24135 Received: (qmail 11297 invoked by uid 1010); 8 Aug 2019 13:08:00 -0000 X-Qmail-Scanner-Diagnostics: from mail-wm1-f49.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.101.2/25531. spamassassin: 3.4.2. Clear:RC:0(209.85.128.49):SA:0(-2.0/5.0):. Processed in 2.107656 secs); 08 Aug 2019 13:08:00 -0000 X-Envelope-From: luomat@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.128.49 as permitted sender) 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== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=SV+tPuXoROfa/JM3bh85l65rRjy96Wn/XFf2Emhq7FY=; b=WkdxZPMITv10tQyQctvbP0lpaFscL0zjRoZjafFjAcBbInS64zOw+U26eQUZN3sk25 2JeVfgEiW2F6hz9mO1dFQ+GIvZouIQNPur9Rx9cY/23EFTmcdg6h5aFiXrDDuGS3Nau0 90K24itblZn3YjCAReE7bNcp4Fcfzz3CS2eHCbBqruzzt3SAm/I08ojxLaZQYgU04EgE bYP7k7mpCw6eJ00Pf+EwYIPSGpBKMYikV1zRbBLfBaDUZYrEZwZs1dPoxF8Zdfd4IPFI xGm8SFgfeKbsUfBZWHTqR7R+6+6U5d/tLzgbhpG3XFEVFqh2wgihhuSgGs0kY51z8z5o wlQA== X-Gm-Message-State: APjAAAURO+t0bwvquP/uxkM5J+t3o94tfVGBS/9bamzkI40Ui0kTg8TN QEZqTaSAUhusEDp5K4YPVcmhV1tgWqXau2OSFtBkXv3rNxI= X-Google-Smtp-Source: APXvYqyeMADeKKFB1sNNtBjUjpkjhS/cca7jL1Ug6tyOu0aopB3zzg5ST3m1fdnqAMvUKPXCM65DeFoJV0hgPbsYbNg= X-Received: by 2002:a1c:b68a:: with SMTP id g132mr4583640wmf.66.1565269644166; Thu, 08 Aug 2019 06:07:24 -0700 (PDT) MIME-Version: 1.0 From: TJ Luoma Date: Thu, 8 Aug 2019 09:06:47 -0400 Message-ID: Subject: completion for function arguments? To: Zsh MailingList Content-Type: text/plain; charset="UTF-8" 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 question below: ## Begin JDIR="$HOME/Library/Mobile Documents/2HCKV38EEC~com~p5sys~jump~servers/Documents/Servers" for ARGS in "$@" do case "$ARGS" in m1|macbook) 'Computer - m1 - 6F333BF4-CF2B-4E98-8281-A79667878D40.jump' ;; imac) FILE='Computer - iMac - 4D391A42-B26E-460E-BDDD-88C9CCA882CF.jump' ;; tyrion) FILE='Computer - Tyrion - 2709D3BB-41BE-4410-8606-6B4DEB92F104.jump' ;; mba|macbookair|air) FILE='Computer - MBA - 4690FEF3-F057-4529-998A-9349F616C1FE.jump' ;; mini|mmcolo|macminicolo) FILE='Computer - MacMiniColo - 13033BED-C6CA-4A5E-970E-47D7869EE09E.jump' ;; *) echo " [jump]: Fatal Error! Don't know what to do with arg: $1" return 1 ;; esac done # for args if [[ -f "$JDIR/$FILE" ]] then open -a 'Jump Desktop' "$JDIR/$FILE" else echo "[jump] No file found at '$JDIR/$FILE'." return 1 fi # End 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 ~/jump/m1 ~/jump/mini ~/jump/mba ~/jump/tyrion ~/jump/imac 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! TjL