zsh-workers
 help / color / mirror / code / Atom feed
From: "Kalmár Gergely" <kgregory89@gmail.com>
To: Roman Perepelitsa <roman.perepelitsa@gmail.com>
Cc: zsh-workers@zsh.org
Subject: Re: --init-file option
Date: Mon, 13 Feb 2023 14:43:59 +0100	[thread overview]
Message-ID: <CAKue2cQ0dC3_TyXYVsqWOtBb+Rsv4=1VztBAnKO+iNJ1x=94gQ@mail.gmail.com> (raw)
In-Reply-To: <CAN=4vMqxKA6yzJgfJZ5cCRT8htPL9pi1NYpeeb+fws04oK3+kQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1733 bytes --]

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ár 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
> > 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.
>

[-- Attachment #2: Type: text/html, Size: 2335 bytes --]

  reply	other threads:[~2023-02-13 13:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-13 10:57 Kalmár Gergely
2023-02-13 11:24 ` Roman Perepelitsa
2023-02-13 13:43   ` Kalmár Gergely [this message]
2023-02-13 20:28     ` Bart Schaefer
2023-02-13 20:34       ` Roman Perepelitsa
2023-02-13 20:59         ` Kalmár Gergely
2023-02-13 21:46           ` Bart Schaefer
2023-02-14 10:18             ` Kalmár Gergely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKue2cQ0dC3_TyXYVsqWOtBb+Rsv4=1VztBAnKO+iNJ1x=94gQ@mail.gmail.com' \
    --to=kgregory89@gmail.com \
    --cc=roman.perepelitsa@gmail.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).