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.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, 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 aed17582 for ; Fri, 16 Aug 2019 01:11:37 +0000 (UTC) Received: (qmail 24193 invoked by alias); 15 Aug 2019 23:37:35 -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: 24145 Received: (qmail 25368 invoked by uid 1010); 15 Aug 2019 23:37:35 -0000 X-Qmail-Scanner-Diagnostics: from mail-io1-f41.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.101.2/25538. spamassassin: 3.4.2. Clear:RC:0(209.85.166.41):SA:0(-1.9/5.0):. Processed in 3.305425 secs); 15 Aug 2019 23:37:35 -0000 X-Envelope-From: dana@dana.is 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.166.41 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dana-is.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=C8Bb9rRfYoe4IwDr13DKUHr3R9ofatyogglhg10AMsg=; b=fU0kBK81xNNIZu/D3yutWkf7ZVzQ3/1a2B1Fjvc3iZ8teE0BLrtvaH3JKIWyaNDWoY 0vvoeiL6Mp1YMsEEToU/6eITOz2gDMBMY3f9ttRK/qhLWMgx03WspbHlci67lmJnRpg9 vlTCJH8e+mSYif9gYQrx0NTEeOI8sqMA3ayVS/2+jk5OiwA2ZfllzEh3//LDQxaWsVRI 2NFHJ6j5gy2GXc4IkJwb3+QazUjIOtYKPRJZdKYaYgyiDn9kqGf3oT4tVVXrNPi+6wxx RY8d7EMjQI1/GBhGG9KB1YXaAAswaYb+n2v8FTTZ5nw6FM6bb9VOcitLiBebkdQfss09 7OKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=C8Bb9rRfYoe4IwDr13DKUHr3R9ofatyogglhg10AMsg=; b=thNoTWz9iQXvd99zVnUDrqgHPU2lhH6A4xpT/gLCvz8q2wR/VrXZFO8J8tr+2aceZW nh95148cEMAtPsiUc/OGyGXf/tweivPfgH4CD1S8mf7cVb0cbmcpNDGiX0PyUjS54rU4 AfiYqO5AvQtukxjQrdXackztsbgMyuGw3WdCTJeCxqk+ZPXQiMvFPc+gm4AY9GndmXtc NqjFoLWLorUdNbqShntUZ2GvHpZ/Ysc9nK+/iSxFhyPKp90OMryk34lqG+m9Sm1SuF/I zzZ4MmnySRcOZ8tBM9NlCqjsmMn4+FRY0xkRKE/3mQKFXq++CKH0pRmt1gkQ460zhKok 6Ksg== X-Gm-Message-State: APjAAAXSTd9kV+fyPyzhga/oOCq2GlXNKBvLrITQ+QcFgJzLnQ34aDPh g5P8QrbRsUHbd1bJtra0YQ2w1Q== X-Google-Smtp-Source: APXvYqyZo15cE0HyYf7OL21pPiqxhsU9L9zAqe3s4/rKF2W2bIQqDO7VGb8Eylq85gI65Sj72Fgp3w== X-Received: by 2002:a02:ba99:: with SMTP id g25mr8078579jao.20.1565912218981; Thu, 15 Aug 2019 16:36:58 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: help for writing GNU stow completion From: dana In-Reply-To: <1e5195bb-3126-8d0c-8a6a-1f5a5fd2a6c0@yahoo.fr> Date: Thu, 15 Aug 2019 18:36:57 -0500 Cc: zsh-users Content-Transfer-Encoding: quoted-printable Message-Id: References: <1e5195bb-3126-8d0c-8a6a-1f5a5fd2a6c0@yahoo.fr> To: =?utf-8?B?QXVyw6lsaWVu?= X-Mailer: Apple Mail (2.3445.104.11) On 6 Aug 2019, at 12:04, Aur=C3=A9lien wrote: > =46rom the command line, when I try to complete something like this: > > % stow --dir=3D$HOME/.dotfiles/ > > I get: 'no packages found in $HOME/.dotfiles/' > > It seems that "$HOME" is not evaluated, and it is the same with "~". = Is > there a way to evaluate these elements? Sorry for the late reply (haven't been paying attention to the ML much recently), but if you still need help with this: Completion functions get arguments on the command line in a 'raw' form, exactly as they're given, including unexpanded parameters, leading = tildes, quotes, &c. That's why you get a literal $HOME instead of its value. You can use the (Q) expansion flag to strip quotes, which is a = semi-common thing in completion functions when they need to take user input from the command line, but there's no flag for anything fancier, and most = functions don't seem to bother with it. But if you wanted to, something like this = is probably the best way...? local -a stow_pkg_list eval set -A stow_pkg_list $1 [[ -n $stow_pkg_list ]] && stow_pkg_list=3D( $stow_pkg_list/*(-/N:t) ) It's not perfectly accurate, though; for example, because of how = _arguments breaks up optargs, this would treat `--dir=3D~/foo` and `--dir ~/foo` = the same, even though the tilde would not actually be expanded before passing it = to stow in the former case (unless magic_equal_subst was enabled) dana