Skip to content

Commit 203289f

Browse files
authored
Support zsh without PROMPT_SUBST (#386)
1 parent c18a6bd commit 203289f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

dist/activate

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,12 @@ function _kctf_activate {
292292
else
293293
_kctf_log "To create a cluster config, run \"kctf cluster create\""
294294
fi
295-
PS1="${PS1}${_KCTF_PROMPT_COLOR1}kCTF[ctf=${_KCTF_PROMPT_COLOR2}${KCTF_CTF_NAME}\$(_kctf_config_string)\$(_kctf_chal_string)${_KCTF_PROMPT_COLOR1}] >${_KCTF_PROMPT_COLOR_END} "
295+
if set -o | grep -E '^promptsubst\s+off' -q; then
296+
_kctf_log_warn "Prompt substitution is disabled. Please run 'setopt PROMPT_SUBST' before 'kctf/activate' for extra prompt information."
297+
PS1="${PS1}${_KCTF_PROMPT_COLOR1}kCTF[ctf=${_KCTF_PROMPT_COLOR2}${KCTF_CTF_NAME}${_KCTF_PROMPT_COLOR1}] >${_KCTF_PROMPT_COLOR_END} "
298+
else
299+
PS1="${PS1}${_KCTF_PROMPT_COLOR1}kCTF[ctf=${_KCTF_PROMPT_COLOR2}${KCTF_CTF_NAME}\$(_kctf_config_string)\$(_kctf_chal_string)${_KCTF_PROMPT_COLOR1}] >${_KCTF_PROMPT_COLOR_END} "
300+
fi
296301
}
297302

298303
function deactivate {

0 commit comments

Comments
 (0)