help / color / mirror / code / Atom feed
From: "Kalmár Gergely" <kgregory89@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Roman Perepelitsa <roman.perepelitsa@gmail.com>, zsh-workers@zsh.org
Subject: Re: --init-file option
Date: Tue, 14 Feb 2023 11:18:46 +0100	[thread overview]
Message-ID: <CAKue2cQEErM8G52Cx_uByqxb0mbnvc3OsC_+uCp6wEb8e1jcPw@mail.gmail.com> (raw)
In-Reply-To: <CAH+w=7aRM++g6yuWbPBaU-n2-uKdAu_=ih60zwVMeF24XF+iGQ@mail.gmail.com>

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

I meant keeping it in a codebase independent of Zsh's.

You are right, bash's --init-file does replace bashrc, so I have to source
that too in my activation script. For my use case I just want to start a
new shell that works the same to the user as when they start a vanilla
shell, with the exception that the virtual environment activation file is
sourced. The activation file sets/modifies a bunch of environment variables
(e.g. PATH, PYTHONHOME and PS1) and changes the working directory. To me
fish shell's --init-command is the most elegant approach, but I can also
live with the same approach as what bash does – in which case I only would
need to source .zshrc in my activation script and not meddle with ZDOTDIR
(which might have unintended side-effects, like what Roman mentioned
regarding the startup files seeing the modified ZDOTDIR instead of what the
user potentially sets it to be).

On Mon, Feb 13, 2023 at 10:46 PM Bart Schaefer <schaefer@brasslantern.com>

> On Mon, Feb 13, 2023 at 12:59 PM Kalmár Gergely <kgregory89@gmail.com>
> wrote:
> >
> > Yes, I could do something similar as what zshi does, but that seems like
> a suboptimal solution, because it would require a duplication (and
> indefinite maintenance) of the startup file processing logic in an
> independent codebase.
> I don't follow that at all.  You're keeping the file for --init-file
> somewhere now (I presume), so why would pointing ZDOTDIR at it require
> a new codebase?
> Anyway "bash --init-file" replaces (both global and user) bashrc
> rather than run the file after them, which doesn't match what you
> originally asked for.  Does it  in fact do what you want?
> Does your file need to create internal variables or functions, or is
> it just populating the environment?

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

      reply	other threads:[~2023-02-14 10:19 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
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 [this message]

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:

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

  git send-email \
    --in-reply-to=CAKue2cQEErM8G52Cx_uByqxb0mbnvc3OsC_+uCp6wEb8e1jcPw@mail.gmail.com \
    --to=kgregory89@gmail.com \
    --cc=roman.perepelitsa@gmail.com \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \


* 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


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).