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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions internal/devbox/shellrc.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@ ignore the existing value of HISTFILE.
HISTFILE="{{ .HistoryFile }}"
{{- end }}

# Prepend to the prompt to make it clear we're in a devbox shell.
export PS1="(devbox) $PS1"
# If the user hasn't specified they want to handle the prompt themselves,
# prepend to the prompt to make it clear we're in a devbox shell.
if [ -z "$DEVBOX_NO_PROMPT" ]; then
export PS1="(devbox) $PS1"
fi

{{- if .ShellStartTime }}
# log that the shell is ready now!
Expand Down
11 changes: 7 additions & 4 deletions internal/devbox/shellrc_fish.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,13 @@ enough approximation for now.
set fish_history devbox
{{- end }}

# Prepend to the prompt to make it clear we're in a devbox shell.
functions -c fish_prompt __devbox_fish_prompt_orig
function fish_prompt
echo "(devbox)" (__devbox_fish_prompt_orig)
# If the user hasn't specified they want to handle the prompt themselves,
# prepend to the prompt to make it clear we're in a devbox shell.
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

{{- if .ShellStartTime }}
Expand Down
7 changes: 5 additions & 2 deletions internal/devbox/testdata/shellrc/basic/shellrc.golden
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ export simple="value";
export space="quote me";
export special="\$\`\"\\";

# Prepend to the prompt to make it clear we're in a devbox shell.
export PS1="(devbox) $PS1"
# If the user hasn't specified they want to handle the prompt themselves,
# prepend to the prompt to make it clear we're in a devbox shell.
if [ -z "$DEVBOX_NO_PROMPT" ]; then
export PS1="(devbox) $PS1"
fi

# End Devbox Post-init Hook

Expand Down
7 changes: 5 additions & 2 deletions internal/devbox/testdata/shellrc/noshellrc/shellrc.golden
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@



# Prepend to the prompt to make it clear we're in a devbox shell.
export PS1="(devbox) $PS1"
# If the user hasn't specified they want to handle the prompt themselves,
# prepend to the prompt to make it clear we're in a devbox shell.
if [ -z "$DEVBOX_NO_PROMPT" ]; then
export PS1="(devbox) $PS1"
fi

# End Devbox Post-init Hook

Expand Down