Skip to content

Option to disable modification of the user's prompt. #1743

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 24, 2024

Conversation

literatesnow
Copy link
Contributor

Summary

Devbox prefixes the user's prompt (PS1) with (devbox) when inside the devbox shell. Unfortunately, this doesn't look great with prompts which have been customized (with starship for example).

Disable prompt modification by setting either DEVBOX_NO_PROMPT or devbox_no_prompt (fish) in your shell. Now the user can detect devbox and display it on their PS1 using the method if their choosing.

Fixes #845.

How was it tested?

bash and zsh

I ran the command in these shells with export DEVBOX_NO_PROMPT=true and without the variable (unset DEVBOX_NO_PROMPT) and observed the results.

if [ -z "$DEVBOX_NO_PROMPT" ]; then
  export PS1="(devbox) $PS1"
fi

fish

Disclaimer, I'm not a fish user. I installed fish and read the documentation.

I added set devbox_no_prompt true to my .config/fish/config.fish, then removed it and observed the results.

if not set -q devbox_no_prompt
    functions -c fish_prompt __devbox_fish_prompt_orig
    function fish_prompt
        echo "(devbox)" (__devbox_fish_prompt_orig)
    end
end

@savil
Copy link
Collaborator

savil commented Jan 24, 2024

@literatesnow thanks for submitting this PR! The proposal LGTM. Would you mind updating the two shellrc.golden files at:

  • internal/devbox/testdata/shellrc/basic/shellrc.golden
  • internal/devbox/testdata/shellrc/noshellrc/shellrc.golden
    ?

That should enable the CICD tests to pass

@savil savil requested review from mikeland73 and savil January 24, 2024 00:00
@literatesnow literatesnow force-pushed the task/disable-shell-prompt-option branch from ffa0b0d to 30acd27 Compare January 24, 2024 07:25
@literatesnow
Copy link
Contributor Author

@literatesnow thanks for submitting this PR! The proposal LGTM. Would you mind updating the two shellrc.golden files at:

* `internal/devbox/testdata/shellrc/basic/shellrc.golden`

* `internal/devbox/testdata/shellrc/noshellrc/shellrc.golden`
  ?

That should enable the CICD tests to pass

Done, thanks for pointing out the files.

@savil savil merged commit bd5a091 into jetify-com:main Jan 24, 2024
@literatesnow
Copy link
Contributor Author

Thank you @savil !

@axkirillov
Copy link

Thank you!

@savil
Copy link
Collaborator

savil commented Jan 25, 2024

oh thank you @literatesnow !

savil pushed a commit that referenced this pull request Feb 9, 2024
## Summary

Documentation for `DEVBOX_NO_PROMPT` from PR #1743.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: prompt hint from devbox mess up my multi line prompt in fish
3 participants