Skip to content

Commit 56254fb

Browse files
committed
cli: Fix incorrect prompt setting for Zsh
It incorrectly always ended up using the Bash method for setting the prompt, and in the Zsh prompt setting, it didn't correctly mark which parts of the prompt are zero-length.
1 parent f031655 commit 56254fb

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

cli/cloe_launch/exec.py

+3-13
Original file line numberDiff line numberDiff line change
@@ -431,20 +431,10 @@ def _write_prompt_sh(self) -> None:
431431
prompt_sh_file = self.runtime_dir / "prompt.sh"
432432
prompt_sh_data = textwrap.dedent(
433433
"""\
434-
CLOE_PROMPT="\u001b[2m[cloe-shell]\u001b[0m"
435-
436-
prompt_cloe() {
437-
if [[ -n $CLOE_SHELL ]]; then
438-
PROMPT="%{%F{242}%}[cloe-shell]%f ${PROMPT}"
439-
fi
440-
}
441-
442-
CURRENT_SHELL=$(basename $0)
443-
if [[ $CURRENT_SHELL = "zsh" ]]; then
444-
autoload -Uz add-zsh-hook
445-
add-zsh-hook precmd prompt_cloe
434+
if [[ -n $ZSH_VERSION ]]; then
435+
export PS1="%{%F{242}%}[cloe-shell]%{%f%} ${PS1}"
446436
else
447-
export PS1="$CLOE_PROMPT $PS1"
437+
export PS1="\u001b[2m[cloe-shell]\u001b[0m $PS1"
448438
fi
449439
"""
450440
)

0 commit comments

Comments
 (0)