fix: setup and arty completion bugs
bin/setup: - Fix Step 1 of 6 → Step 1 of 7 - exec zsh -l </dev/tty to avoid inheriting stale curl pipe on stdin (without /dev/tty the curl|sh pipe bytes re-run the script as zsh) - Fall back to printing exec zsh hint when /dev/tty is unavailable - Check completion file existence instead of trusting arty exit code bin/arty: - Fix cmd_completion returning exit 1 for zsh: last statement was [[ "$shell" == "bash" ]] which is false, changed to if/fi Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1362,7 +1362,9 @@ cmd_completion() {
|
|||||||
|
|
||||||
echo "$content" > "$dest"
|
echo "$content" > "$dest"
|
||||||
log_success "$shell completion installed: $dest"
|
log_success "$shell completion installed: $dest"
|
||||||
[[ "$shell" == "bash" ]] && log_info "Reload: source $dest"
|
if [[ "$shell" == "bash" ]]; then
|
||||||
|
log_info "Reload: source $dest"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# USAGE AND HELP
|
# USAGE AND HELP
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ detect_os() {
|
|||||||
|
|
||||||
# ─── Step 1: Prerequisites ────────────────────────────────────────────────────
|
# ─── Step 1: Prerequisites ────────────────────────────────────────────────────
|
||||||
check_prerequisites() {
|
check_prerequisites() {
|
||||||
step_header "Step 1 of 6 — Prerequisites"
|
step_header "Step 1 of 7 — Prerequisites"
|
||||||
|
|
||||||
detect_os
|
detect_os
|
||||||
log_info "OS detected: ${BOLD}$OS${NC}"
|
log_info "OS detected: ${BOLD}$OS${NC}"
|
||||||
@@ -310,7 +310,8 @@ install_completion() {
|
|||||||
|
|
||||||
# arty completion zsh --install writes to the first writable fpath dir,
|
# arty completion zsh --install writes to the first writable fpath dir,
|
||||||
# defaulting to ~/.zsh/completions/_arty (which .zshenv/oh-my-zsh picks up).
|
# defaulting to ~/.zsh/completions/_arty (which .zshenv/oh-my-zsh picks up).
|
||||||
if ! (cd "$HOME" && "$arty_bin" completion zsh --install); then
|
(cd "$HOME" && "$arty_bin" completion zsh --install) || true
|
||||||
|
if [[ ! -f "$HOME/.zsh/completions/_arty" ]]; then
|
||||||
log_warn "arty completion zsh --install failed — skipping."
|
log_warn "arty completion zsh --install failed — skipping."
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -348,10 +349,13 @@ main() {
|
|||||||
install_completion # Step 6
|
install_completion # Step 6
|
||||||
post_install # Step 7
|
post_install # Step 7
|
||||||
|
|
||||||
# Hand off to zsh immediately — no need to exec zsh manually.
|
# Hand off to a zsh login shell immediately.
|
||||||
if command -v zsh >/dev/null 2>&1; then
|
# Read from /dev/tty so zsh gets the terminal, not the leftover pipe bytes
|
||||||
exec zsh -l
|
# from the curl|sh pattern (which still has the tail of this script buffered).
|
||||||
|
if command -v zsh >/dev/null 2>&1 && [[ -e /dev/tty ]]; then
|
||||||
|
exec zsh -l </dev/tty
|
||||||
fi
|
fi
|
||||||
|
echo -e "${YELLOW}[!]${NC} Start a new shell session: ${BOLD}exec zsh${NC}"
|
||||||
}
|
}
|
||||||
|
|
||||||
main "$@"
|
main "$@"
|
||||||
|
|||||||
Reference in New Issue
Block a user