Skip to content

Commit

Permalink
cli: Fix incorrect prompt setting for Zsh
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cassava committed May 12, 2023
1 parent f031655 commit 56254fb
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions cli/cloe_launch/exec.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,20 +431,10 @@ def _write_prompt_sh(self) -> None:
prompt_sh_file = self.runtime_dir / "prompt.sh"
prompt_sh_data = textwrap.dedent(
"""\
CLOE_PROMPT="\u001b[2m[cloe-shell]\u001b[0m"
prompt_cloe() {
if [[ -n $CLOE_SHELL ]]; then
PROMPT="%{%F{242}%}[cloe-shell]%f ${PROMPT}"
fi
}
CURRENT_SHELL=$(basename $0)
if [[ $CURRENT_SHELL = "zsh" ]]; then
autoload -Uz add-zsh-hook
add-zsh-hook precmd prompt_cloe
if [[ -n $ZSH_VERSION ]]; then
export PS1="%{%F{242}%}[cloe-shell]%{%f%} ${PS1}"
else
export PS1="$CLOE_PROMPT $PS1"
export PS1="\u001b[2m[cloe-shell]\u001b[0m $PS1"
fi
"""
)
Expand Down

0 comments on commit 56254fb

Please sign in to comment.