From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5871 invoked by alias); 2 Jun 2017 18:26:13 -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: X-Seq: 22725 Received: (qmail 28696 invoked from network); 2 Jun 2017 18:26:13 -0000 X-Qmail-Scanner-Diagnostics: from out1-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(66.111.4.25):SA:0(-0.7/5.0):. Processed in 2.238986 secs); 02 Jun 2017 18:26:13 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at daniel.shahaf.name does not designate permitted sender hosts) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=pf/Nbg EFuZJKLdzZhjaF5uTJV+ZZVvci3yAerAbJ/mU=; b=yN7ar06F2XJ99OETrc6DZq eOWjz4K6/A8hCEyuRPK8cVd2odE3VrhOyCnBcIZnaPR+QTXAOU321/EAdIPW5cx7 qKDA41RS2NE3Qj1NX9Hzqo141Ua/12eZH8zZ3pX/l5q7EaUf9Msk9NT+CT7SL89z unubQmYStMMQD0GRd6vyO7O8ldaAWPi0H0I+y/M/bUMjgpw1abvORLkz5tmJhA65 cihypsuHzkSkzPt0PqJZljTrBsrI54c5+9y1z6DMxz4zeVpsifEIbfwgt2nvc+/p dOAfhKMD/Z/rCeLAnVOPW61doFHbqZNVSGH0+BRsbyko/CHdfxkXG8uASt3coRFQ == DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=pf/Nbg EFuZJKLdzZhjaF5uTJV+ZZVvci3yAerAbJ/mU=; b=Rad7Ej+D/82obuUzo54/fD 2kCXf6Y0AzysCZpXZoXwgMfFWf7IFLrz6SkEK5Ot5cAErgOcCvtIsop+eYX+ulft cX8IkuKk7ATI1QpDY+H/eIDCRUr36x7Dzr5qjB8Nk4R08V8wUeNlTyv/FsNIP9Rh OAPNjgN76zL7xtQp3yFXBDwoKNEjv7AkTewV2GVivbOV4ajaJkxY8twMKoIvGFX2 TIyFd20ynjH52fAv94yJ1cLgdU2eMisJcDoxVdZkkmtpYo2gTAgyVJPSEhPkNVP+ xcnLjPTewrUbad5T3Cu0Fif+1kGAGUjcll/L26daU51lr8yxW3vTJXouxm9zSW+w == X-ME-Sender: Message-Id: <1496427961.3459908.996916880.0977D5D0@webmail.messagingengine.com> From: Daniel Shahaf To: zsh-users@zsh.org MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" X-Mailer: MessagingEngine.com Webmail Interface - ajax-48639608 Date: Fri, 02 Jun 2017 18:26:01 +0000 In-Reply-To: <20170602094656.2945cd77@pwslap01u.europe.root.pri> References: <20170531064655.GA8512@localhost.localdomain> <20170531094310.59bb7110@pwslap01u.europe.root.pri> <20170601054320.GA3602@localhost.localdomain> <20170601101945.02560589@pwslap01u.europe.root.pri> <20170602035746.GA6211@localhost.localdomain> <20170602094656.2945cd77@pwslap01u.europe.root.pri> Subject: Re: How to complete alias after alias of sudo? Peter Stephenson wrote on Fri, 02 Jun 2017 09:46 +0100: > Standard case: "sudo -i" runs the command in a shell, so it will use > whatever shell environment has been provided in the sudo environment. > In general we don't know what that is, and quite like using the local > environment for completing functions and aliases isn't right. But > without much more digging this may be the best solution. There's no easy way for us to complete aliases for root; we don't even know what shell sudo will run its command under. However, we could add a layer of indirection so people can fill this in their own configs: [[[ _arguments ... '(-)1:command:_sudo_command' _sudo_command() { if -i or -s passed: _sudo_aliases else _command_names fi } _sudo_aliases() { _command_names -e } ]]] ... and document that _sudo_aliases is intended to be overwritten/redefined by a user's .zshrc file.