Skip to content

Avoid adding modified PATH to multiple shell config files #46

Open

Description

@chrysle

userpath.append() seems to write the modified PATH to all available shell configuration files currently. Example:

$ mkdir temp/ && userpath append -s bash temp/
$ tail -n 2 .bashrc && tail -n 2 .profile 
# Created by `userpath` on 2023-06-18 13:18:55
export PATH="$PATH:/home/user/temp"
# Created by `userpath` on 2023-06-18 13:18:55
export PATH="$PATH:/home/user/temp"

I'd think there should be an option to turn that off. Or is there?

This code seems to be responsible for the behaviour:

for shell in self.shells:
for file, contents in shell.config(location, front=front).items():

Activity

  1. chrysle commented on Jun 29, 2023

    @chrysle
    ContributorAuthor

    @ofek Would you be interested in such a feature (maybe through a command line option)? If so, I'd be happy to contribute.

  2. ofek commented on Jun 29, 2023

    @ofek
    Owner

    I would very much appreciate that! I think maybe what you're talking about should be the default behavior, see this issue #3 (comment)

  3. chrysle commented on Jul 7, 2023

    @chrysle
    ContributorAuthor

    Could you state your preference, then? Only adding to shell login file, or a CLI option like --file and environment variable, or both?

  4. ofek commented on Jul 7, 2023

    @ofek
    Owner

    Preferably both but the former for sure, just modify one file by default

  5. lingfish commented on Aug 31, 2025

    @lingfish

    Hrm, and then #48 was reverted?!?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions