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.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 17398 invoked from network); 13 Feb 2023 13:44:30 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 13 Feb 2023 13:44:30 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1676295870; b=Mztk/hq5s9+qhYqbVfBbwS5XigccvsMTlrZdDKaR//CU7Ty1Y+2OIpk58I9tyBIwEB7b326a8o hKN/I+W3nA5PUh0JueSKBPtaX69+/iUK03lyLla2vnsEcBQ0FklryDWlwKr5+bO8NGM4e8gGj7 9c1g/PXfp1AoGO6F5+W226/ddA+2IibZyRcsGzhKNJ2f5CYez9opUn+lJR0a5/PP7qI2sjUnzS 5Eigi/fWsIosuD/KmWbTlARK0KdZn+/z+yGhb/ud/eaYvVs9TJFyx9lL33Twl06QVq+B1UEKJA nonPM0AmV/FsNw85g7MEAmWufjD/8P/giEHELhNWXFl/2Q==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-qk1-f178.google.com) smtp.remote-ip=209.85.222.178; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1676295870; bh=BY94UDg28v9AbGRndgdCtfPIGNOdIE5o5UUlecP87YA=; 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=crtPt/fTgBkkRZzeY4PoY0sV6G69CgNOpvNcywhrmon87br/NujmKBBUKx4TP+G3UFa5/tnVrx bg/jIvGdeGsSzhyC+aLSb5WXye9bx43MolOGHDgN3kjrLchV+rDJOmKxfl6XQFErUYvxyJ7D1U 6RCfILRFg79Fntl1/f9475H84Nh6mw7GisVmbcCEvl1NwBu1jGrMw8godUGD1ErHzz8V8pkxba pUCSssU9zqsnt/Q646cfqe3l6zvccy6QUa/3Uu+s/SmFku54iZLUO18pYCXRHFkuksBzxhZKot W6NHGIzA9p37+snqOC50qGmQVOm/GS4aw6wChf/MG1C4Lg==; 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=Jc3eAAGbF+3E71LFPeueXTIaDfpE91zYwLnnftGaCEg=; b=YnWTk0Czvh/yd+ZhC7nzzdQmXd dLkz6J3ar2DtFIMUX1mw38SKVx7NS84sCo01WREOMaLhwaxfJ3aeyt0Xfq8XWCoYkAfqbHAkntrGT LCsjI19gDbOujcFkjspRWe6dzkMiKzelBJOdnXIAXNjN6FVO0T5QuXUKW6kt+iHJRkxEPPyzYCSsh jIs1xj/Kjl31TkhAJJ81ZogFIyZnz1I8BTVYHPmDF0xjpIHZPTBuJ6WTm7q840mDtFPC43ILziNfG wDKDE6Aa6HY+1q5SVVBIoQ9TuUNCh1EVxwssCgj4L5x8t6FbEP4Wa7IGiKxNno+QzYKjA2uzuZVXa ivRIQ2Dg==; Received: by zero.zsh.org with local id 1pRZ89-000FMQ-Eb; Mon, 13 Feb 2023 13:44:29 +0000 Authentication-Results: zsh.org; iprev=pass (mail-qk1-f178.google.com) smtp.remote-ip=209.85.222.178; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-qk1-f178.google.com ([209.85.222.178]:46748) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1pRZ7r-000F2c-Kz; Mon, 13 Feb 2023 13:44:12 +0000 Received: by mail-qk1-f178.google.com with SMTP id 135so4784500qkh.13 for ; Mon, 13 Feb 2023 05:44:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Jc3eAAGbF+3E71LFPeueXTIaDfpE91zYwLnnftGaCEg=; b=MN/krp7ojGo1XrbpgVwCsnIm1QWX+/oJsIzBGZYfP4SrZ0Cnl1OL7mYqNrdMG68qTf rmva57MdW74C0LkO+aqfXCPfMmNZX+dnKwW+AngPr6V094JGGhQ+xjIyhFq2e5BlDSO3 kF1MfqrZgWpgfc59s7jCVckYEWN0s8lHclwTOFX9VjTooMn9QTnpqSUjyJajVEjDP3P5 hAsTx5uDkO9Nkii8KhxcBAIqoIhz2iwFnp8su/PkvIjtLEQbjTpXl4qR+k6haLvyTt6T JAAtxSB3JT0u/1ODJrbVqkDydOK+UxdyT8CdbqS2zWnNlr16dTiOyohiKP8PDuRUsSir HSKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Jc3eAAGbF+3E71LFPeueXTIaDfpE91zYwLnnftGaCEg=; b=Qx+5n6McQvcDdf57dOYP3KO6waXHv6HBNRSY7TzA91vdP1hZe8muE2EQtJ5vFwDw6e M12nvkxO2CgbNLmZRHOTPK3ocbgXWpZ7Q6t1NurKYZ2A2hxp1usMVPuoifs5sJ3AM2fQ F0sLZdcnHYfcya6caD815iE4oAL+0Owv3lHubyNIvRtDsI3H+zZ9oKFWw0olzJO5+5jR jjPuFxYv1ioeXP/Ib4X6adjJuiph+gf3eDc4ZtABH0TESvPUvOabH7Z13vf+5kmZK5iq qoPLD66FRWIXjTFbMOOw4xebIaTkS87s/kSakM/aX/I28CvoYZYCjbmopjue+UKhz9nR QomQ== X-Gm-Message-State: AO0yUKUDrzTQctuclZK6tXRaWf++Y4xnfuyds2taGEaJijW9AD8nrMc8 GTuvGWLm02Ch2fKZSh+Y86S3cYhUctJ9UFi5TSBKsaTy X-Google-Smtp-Source: AK7set8yxpFk86T6zHF9WYpC4WmK3xMju05t5a70gnj0jSD/L+1mSVdt0TpUXa5iRk5zfYalak1ShLb6MgvUclnmgik= X-Received: by 2002:a37:4553:0:b0:738:8c00:30c7 with SMTP id s80-20020a374553000000b007388c0030c7mr1743538qka.280.1676295850538; Mon, 13 Feb 2023 05:44:10 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: =?UTF-8?Q?Kalm=C3=A1r_Gergely?= Date: Mon, 13 Feb 2023 14:43:59 +0100 Message-ID: Subject: Re: --init-file option To: Roman Perepelitsa Cc: zsh-workers@zsh.org Content-Type: multipart/alternative; boundary="000000000000b5d68305f4950a33" X-Seq: 51424 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: --000000000000b5d68305f4950a33 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thank you! Yes, I'm already using the -c 'source xxx; command' approach with Bash/fish, and you are right, it should work with Zsh too of course. Nonetheless, the problem of starting Zsh with an activated virtual environment remains. I suppose the next question is if the maintainers would consider adding this feature to Zsh to support use cases like these, just as Bash/fish do (which is why I thought writing to zsh-workers instead of zsh-users was perhaps going to be more appropriate). Best, Gergely On Mon, Feb 13, 2023 at 12:24 PM Roman Perepelitsa < roman.perepelitsa@gmail.com> wrote: > On Mon, Feb 13, 2023 at 11:58 AM Kalm=C3=A1r Gergely > wrote: > > > > I was wondering if there is an equivalent to Bash's --init-file > > option or fish shell's --init-command option in Zsh or if one can > > hack around to achieve the same effect. I would need to be able to > > source a virtual environment activation file after the Zsh startup > > files were processed (but before a command is executed) in order to > > be able to start a shell or run commands inside a Python virtual > > environment. > > If you are executing a script or a command, then instead of this: > > zsh foo > zsh -c 'foo' > > you can do this: > > zsh -c 'source /path/to/your/file; foo' > > If you need to start an interactive zsh that sources an extra file > after the usual startup files, and if you cannot modify any of the > standard startup files, then https://github.com/romkatv/zshi or > something like it is the only option. Disclaimer: It's my project but > I'm not using this code myself. > > P.S. > > This question is more suitable for zsh-users than zsh-workers. > --000000000000b5d68305f4950a33 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thank you! Yes, I'm already using the -c 'source x= xx; command' approach with Bash/fish, and you are right, it should work= with Zsh too of course. Nonetheless, the problem of starting Zsh with an a= ctivated virtual environment remains.

I suppose the next= question is if the maintainers would consider adding this feature to Zsh t= o support use cases like these, just as Bash/fish do (which is why I though= t writing to zsh-workers instead of zsh-users was perhaps going to be more = appropriate).

Best,
Gergely
<= br>
On Mon,= Feb 13, 2023 at 12:24 PM Roman Perepelitsa <roman.perepelitsa@gmail.com> wrote:
On Mon, Feb 13, 2023 at 11:5= 8 AM Kalm=C3=A1r Gergely <kgregory89@gmail.com> wrote:
>
> I was wondering if there is an equivalent to Bash's --init-file > option or fish shell's --init-command option in Zsh or if one can<= br> > hack around to achieve the same effect. I would need to be able to
> source a virtual environment activation file after the Zsh startup
> files were processed (but before a command is executed) in order to > be able to start a shell or run commands inside a Python virtual
> environment.

If you are executing a script or a command, then instead of this:

=C2=A0 =C2=A0 zsh foo
=C2=A0 =C2=A0 zsh -c 'foo'

you can do this:

=C2=A0 =C2=A0 zsh -c 'source /path/to/your/file; foo'

If you need to start an interactive zsh that sources an extra file
after the usual startup files, and if you cannot modify any of the
standard startup files, then https://github.com/romkatv/zshi or something like it is the only option. Disclaimer: It's my project but I'm not using this code myself.

P.S.

This question is more suitable for zsh-users than zsh-workers.
--000000000000b5d68305f4950a33--