broot icon indicating copy to clipboard operation
broot copied to clipboard

Is it deliberate that both .bashrc and .bash_profile are editted?

Open 3tilley opened this issue 2 years ago • 4 comments

Lots of .bash_profiles load .bashrc, does the br script need to be installed into both? Once one is found, could the other be left? Should it favour .bash_profile from a quick read of this stackoverflow

3tilley avatar Oct 26 '23 02:10 3tilley

Yes, it's deliberate, it's required by MacOS: https://github.com/Canop/broot/issues/84

What downside is there ?

Canop avatar Oct 26 '23 06:10 Canop

Ah ok, I saw the comments and thought it might be to do with Mac. Does that mean if it's just in .bash_profile on mac it would work? Or I guess .profile now that zsh is the default on newer models?

Edit:

Additionally I have a slightly non-standard set-up where I put some items in ~/.bash_local and then source that from .bash_profile. This has the advantage that I don't have to check things into my dotfiles repo that contain local paths, so I can share that across multiple machines while having small local configs that hardcode to specific locations.

Reasoning is by the by, but since I don't have anything in the standard files I get the warning to setup up a shell function, even though I already have one. I'm guessing this just comes up once? It's not a big deal, but a bit confusing to run a br shell function and then get a message saying "make sure you run broot from a br shell function". Should br call broot with a certain flag to indicate that it was a shell func and suppress that?

3tilley avatar Oct 26 '23 11:10 3tilley

Should br call broot with a certain flag to indicate that it was a shell func and suppress that?

This flag is the outcmd launch argument. Broot must be launched with this argument to be able to execute a command from the parent shell. If you run broot from a shell function and it doesn't pass this argument, it's useless.

Canop avatar Oct 26 '23 14:10 Canop

I'll leave this question open for the discussion of which rc/profile files should be editted, I've moved the discussion of br still asking for setup to #774

3tilley avatar Oct 27 '23 22:10 3tilley