refactor: use drop-ins for aliases and path management

This commit is contained in:
2026-06-24 19:57:38 +05:30
parent 725e3879d8
commit 0486755771
12 changed files with 121 additions and 132 deletions

View File

@@ -135,22 +135,13 @@ install_agy() {
}
configure_shell() {
# Ensure $TARGET_DIR is in PATH for shell configurations if not present
# Clean up legacy in-place configuration blocks
IFS=' ' read -ra target_files <<< "$(get_shell_configs)"
local path_content='export PATH="$HOME/.local/bin:$PATH"'
for config_file in "${target_files[@]}"; do
if [ -f "$config_file" ] && ! grep -q '\.local/bin' "$config_file" 2>/dev/null; then
log_info "Adding ~/.local/bin to PATH in $config_file..."
inject_block "$config_file" "local-bin path" "$path_content"
# Source if modified (only for bashrc)
if [ "$config_file" = "$HOME/.bashrc" ]; then
. "$config_file" 2>/dev/null || true
fi
fi
remove_block "$config_file" "local-bin path"
done
write_env_snippet "local-bin" 'export PATH="$HOME/.local/bin:$PATH"'
}
run_handoff() {