#!/bin/zsh -eu TARGET_USER="usr_vscode" if [[ "$EUID" -eq 0 ]]; then target_home="/home/${TARGET_USER}" else target_home="$HOME" fi zshrc="${target_home}/.zshrc" mkdir -p "${zshrc:h}" touch "$zshrc" vscode_marker='if [[ "$TERM_PROGRAM" == "vscode" ]]; then' if ! grep -Fq "$vscode_marker" "$zshrc" 2>/dev/null; then cat <<'EOF' >>"$zshrc" if [[ "$TERM_PROGRAM" == "vscode" ]]; then local vscode_executable if command -v code >/dev/null 2>&1; then vscode_executable="code" elif command -v code-insiders >/dev/null 2>&1; then vscode_executable="code-insiders" fi if [ -n "$vscode_executable" ]; then . "$($vscode_executable --locate-shell-integration-path zsh)" fi fi EOF fi alias_snippet="alias clean-node-modules='setopt rm_star_silent; rm -rf node_modules/.*; rm -rf node_modules/*'; unsetopt rm_star_silent" if ! grep -Fqx -- "$alias_snippet" "$zshrc" 2>/dev/null; then printf '\n%s\n' "$alias_snippet" >>"$zshrc" fi