prefix-dev / pixi

Package management made easy
https://pixi.sh
BSD 3-Clause "New" or "Revised" License
2.26k stars 135 forks source link

PS1 shell improvements #364

Closed wolfv closed 8 months ago

wolfv commented 9 months ago

Problem description

We are setting the PS1 in different ways:

I think we should find a way to add $PIXI_PROMPT to the different PS1 mechanisms.

twrightsman commented 9 months ago

I think I had to add a line to my .bashrc with pixi 0.4 to get the prompt to work:

export PS1="${PIXI_PROMPT}${PS1}"

Once this issue is closed will I be able to remove that last bit of pixi-specific code in my .bashrc?

ruben-arts commented 9 months ago

@twrightsman You should be ablt to loose that export as that is also specified in src/cli/mod.rs

So as long as you add the completion script to the .bashrc you'll have all the featuers.

eval "$(pixi completion --shell bash)"
twrightsman commented 9 months ago

I removed the export PS1 command above from my .bashrc and tested it with pixi 0.5, but the prompt doesn't update with the environment name. I do see source /tmp/pixi_env_H01.sh now in my history though, which is new.

Edit: Ah, I see the snippet @ruben-arts linked to is the completion installation script. I'd like to not have anything in my .bashrc, even completions.

ruben-arts commented 9 months ago

Ah yeah that is not possible yet.

ruben-arts commented 8 months ago

This is now working for all the above mentioned prompts + xonsh so this issue is closed :tada:

more info; https://github.com/prefix-dev/pixi/blob/main/src/prompt.rs