From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 1427 invoked from network); 25 Aug 2021 14:58:43 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 25 Aug 2021 14:58:43 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1629903523; b=Ty+7H2dDoQY5eeVvnT/dd5moIwqoS5SoMW9QFq+OfrjlTIr/mJH1SBTg9h/xw5SbiYaiDxcPiu quRXkezVQSAH92byTbstA7PVuTQRMd+QQCBb7FBTE9ii526tmP+SBQ4E8/nHrqsSoudVnzvYS9 dk7R/5XOoO4mUeY1q5T4KhouFhm/mUJG2AEZjYXFOrp5RWYSgxcCcqvPG6wmiE1OKUNU2p3tWz 1LFqryxyeZ/f2YH8JG6YfF5OhUYw/ZdMWAIkYPoDsqBaYBmf3BrpBbkABcTYX9km8sQniD8FSV glb2KWp0I+xbQEPrl+3FdSBVCMwRAsZFJ3440NBiSrlICg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-yb1-f173.google.com) smtp.remote-ip=209.85.219.173; dkim=pass header.d=brasslantern-com.20150623.gappssmtp.com header.s=20150623 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1629903523; bh=4NdmF2x9yYBusb3yMOWB/fxiWfhkBvZx+O/E5UbvK6w=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=qL+HhUbaRO1S8jDXMA5fXjEtnCFkOhLmj+3tlxofxVcN5K6qViluT00Ot9XdU6T4sdiOSBFD6c S76K8BfHhNvKEUqoP5mxKkuqQvJfFu3ErxO7HhJll3JYSQ8jTPExW2gCRC7KNR34Ks9NACPpAp 1OSj9mNKZlEQ47Ugi57OfAn6shjSwERWka+Qqywd3BAK8yL5LdpFykoTVEPAUiCTFwtnfF7F8h 52lBI1GXyDfyygz0J6sJUqATzN3N6+6RQfRa6qDp09LpPHOFoVxZB3h/IoulxZltX+9fi59JwE 4kY/NZxSOQ4t7ntI/VDwhmPCB5HZqqh/XV5jPg6l1cycEw==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=usxDrgv538haXJNUy4jHW56/vszMB0ir0gdCp9l++U0=; b=R+Q7gAzC71gucUX1JZeBSu1Pml 0/MzTvVJUiYFUAyM4ua3ItCRqRuz8nvozSxr07Tds+NV3CrUwDGCVKFl8aurblAR8rBTwHGuCh/tW F9fy3V7dRCuZvP1jol7cgcxv7FHdp9/ixrxK+vIIbIvtYvV0AI2k1JAnmUmJTYqa/vddLybnX//OH 97nEvfZPDQXJrH/PnKRgaFIAzNiKeyTuBWolYVEnrni2rlbdUW0T6LmpRJIpXLHSO4deaNhbtXvOG 5mtRSYWzpqSBndQzrSIPgo9tt3kr2eYFBJDGukn+Cp6WEJrleVbF1WuPIzicLVnIPRHqSiD9SJQPR 2WUCMeqg==; Received: from authenticated user by zero.zsh.org with local id 1mIuMU-000J1k-WA; Wed, 25 Aug 2021 14:58:43 +0000 Authentication-Results: zsh.org; iprev=pass (mail-yb1-f173.google.com) smtp.remote-ip=209.85.219.173; dkim=pass header.d=brasslantern-com.20150623.gappssmtp.com header.s=20150623 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-yb1-f173.google.com ([209.85.219.173]:47091) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1mIuLh-000IIP-5w; Wed, 25 Aug 2021 14:57:53 +0000 Received: by mail-yb1-f173.google.com with SMTP id k65so48440740yba.13 for ; Wed, 25 Aug 2021 07:57:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=usxDrgv538haXJNUy4jHW56/vszMB0ir0gdCp9l++U0=; b=C9V/+LrsZwr44BoZjQuUcJnnnWW8BHrHndknostUrliCijMtcUq7c1TyCGeLt/Qzq2 a0GUOHeLZGWbsMUwaDY8bphRVarl0kIS27uxK5R7dZKO2zE+lPumKfRXx9IAOX6tJwa8 ZcwnoUdxINS35Icwn2DZXY2q5OR4xFYbQVrF9GYeJ3lF+LOn28LHfTcqh9TFWsRK7+nk 3pWUDW8qikkwVNzW5wND0pPiT7iHXbeVtII2S0lqeyoYkHQIUbCAy9as6aTzKkQXm+p5 gl3vj2lLoBXI0qWmxhuBhoV+TT/yhqgoaZ0Ks3h59MrjZYLoDAdfHhculcvvhAHzNxjj PNhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=usxDrgv538haXJNUy4jHW56/vszMB0ir0gdCp9l++U0=; b=FEwnk3tECMPxjymjzkt9jLSUY2I3lY4QgjwQDLCemTyXAgEvjHtJXmNtfcqhhiuJL2 AgZB85r+LTL+eJKKKj3W1QHfz+tAOa6yu44tnobRHp8JTTgzUCb7WQz0V3iNpjS3wPP3 PihWPIbh/KEQNeTQXP0ewvySYczpfCWCuRBLQH0fHaxvdHCj6rA8jw2BV34PKfrR0UaS ssrf15ryUSunoGi1VJSRPXTH33kxwv5qsf6UMarxG0UcVmeWwKKI2jEyHeZEzzQi/UlH Z+LGjAXDga0+xXEGz26L8x6j7/+ctzxGblU2aq37rUDWEu8ooX71292/IqxWfkElI4uu FH9Q== X-Gm-Message-State: AOAM532vphLeNaQldYDLBDVIbJwsNbES9+6PLK68YkYBxdiCoHUBTTIf KsgS2BbZ+pTzbP/TFSgpFbd4c5Rqd2q3oxed0fNtBw== X-Google-Smtp-Source: ABdhPJxA1e80fVBcSPYsRV9zkDvOLNC48r4EtNgC651o2Dk/KzxcMXvenC80gYGFI8Jig6vi1rMPQJwJ3AgKglxWsEk= X-Received: by 2002:a25:25cf:: with SMTP id l198mr36510523ybl.14.1629903471771; Wed, 25 Aug 2021 07:57:51 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Bart Schaefer Date: Wed, 25 Aug 2021 07:57:41 -0700 Message-ID: Subject: Re: Can $PATH look into sub-folders? To: TJ Luoma Cc: Zsh MailingList Content-Type: text/plain; charset="UTF-8" X-Seq: 26978 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: On Wed, Aug 25, 2021 at 7:17 AM TJ Luoma wrote: > > My question is whether or not there is an option (a zsh-specific option is fine) which would tell zsh to include sub-folders of $PATH folders without having to explicitly add them all to $PATH. Not directly, no. There are a couple of ways to approach this that I can think of: Zero, the PATH_DIRS approach that PWS already mentioned. One, if the subdirs contain shell scripts that can be run by zsh, you can zcompile the entire tree into a bundled .zwc at a level that is in the path, but that turns them into shell functions which may not be the behavior you want. Two, use a command_not_found_handler function to invoke a deeper search if the initial search doesn't work. Three, instead of explicitly adding directories to the path, add the commands themselves with the "hash" builtin. Four, combine two and three: Locate the command with command_not_found_handler, and then before running it, update a file with the location. In precmd, check for modification of that file, and "hash" the newly-found command.