remove zsh support
This commit is contained in:
@@ -178,7 +178,7 @@ These are pre-loaded by `bootstrap.sh` — no need to source them manually in in
|
||||
|
||||
| Function | Description |
|
||||
|---|---|
|
||||
| `get_shell_configs` | Space-separated list of existing RC files (`~/.bashrc`, `~/.zshrc`) |
|
||||
| `get_shell_configs` | Space-separated list of existing RC files (`~/.bashrc`) |
|
||||
| `inject_block <file> <name> <content>` | Idempotently inject a named block into a config file (removes old block first) |
|
||||
| `remove_block <file> <name>` | Remove a named block from a config file |
|
||||
| `add_alias_if_missing <file> <alias> <value>` | Add an alias line if not already present |
|
||||
|
||||
@@ -81,7 +81,6 @@ fi
|
||||
install_bootstrap() {
|
||||
local target_files=()
|
||||
[ -f "$HOME/.bashrc" ] && target_files+=("$HOME/.bashrc")
|
||||
[ -f "$HOME/.zshrc" ] && target_files+=("$HOME/.zshrc")
|
||||
|
||||
local routes_dir="$HOME/.config/bootstrap"
|
||||
mkdir -p "$routes_dir"
|
||||
@@ -208,11 +207,7 @@ if [ "$is_sourced" = false ]; then
|
||||
echo
|
||||
log_success "Bootstrap CLI installed successfully!"
|
||||
log_info "To start using the 'b' command in this terminal session, run:"
|
||||
if [ -f "$HOME/.zshrc" ]; then
|
||||
echo " source ~/.zshrc"
|
||||
else
|
||||
echo " source ~/.bashrc"
|
||||
fi
|
||||
echo " source ~/.bashrc"
|
||||
else
|
||||
# Sourced mode (e.g., when sourced by installers or manually by user)
|
||||
# Load the b function in the current shell context
|
||||
|
||||
@@ -149,7 +149,7 @@ main() {
|
||||
|
||||
echo
|
||||
log_success "Bat installation and configuration complete."
|
||||
log_info "Please close and reopen your terminal or run: source ~/.bashrc (or source ~/.zshrc) to apply changes."
|
||||
log_info "Please close and reopen your terminal or run: source ~/.bashrc to apply changes."
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
||||
@@ -149,7 +149,7 @@ main() {
|
||||
log_info "Installed NVM version: $(nvm --version 2>/dev/null || cat "$HOME/.nvm/package.json" | grep '"version":' | head -n1 | sed -E 's/.*"version": "([^"]+)".*/\1/' || echo "unknown")"
|
||||
else
|
||||
log_success "Installation complete."
|
||||
log_info "Please close and reopen your terminal or run: source ~/.bashrc (or source ~/.zshrc) to verify."
|
||||
log_info "Please close and reopen your terminal or run: source ~/.bashrc to verify."
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -238,7 +238,7 @@ main() {
|
||||
log_info "Installed pnpm version: $(pnpm --version 2>/dev/null || echo 'unknown')"
|
||||
else
|
||||
log_success "Installation complete."
|
||||
log_info "Please close and reopen your terminal or run: source ~/.bashrc (or source ~/.zshrc) to verify."
|
||||
log_info "Please close and reopen your terminal or run: source ~/.bashrc to verify."
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -102,32 +102,23 @@ configure_shell() {
|
||||
# Add ~/.local/bin to PATH for the current process
|
||||
export PATH="$HOME/.local/bin:$PATH"
|
||||
|
||||
IFS=' ' read -ra target_files <<< "$(get_shell_configs)"
|
||||
|
||||
for config_file in "${target_files[@]}"; do
|
||||
local shell_name="bash"
|
||||
if [[ "$config_file" == *".zshrc" ]]; then
|
||||
shell_name="zsh"
|
||||
fi
|
||||
|
||||
local config_file="$HOME/.bashrc"
|
||||
if [ -f "$config_file" ]; then
|
||||
# Ensure ~/.local/bin is in PATH for this file if not already present
|
||||
if [ -f "$config_file" ] && ! grep -q '\.local/bin' "$config_file" 2>/dev/null; then
|
||||
if ! grep -q '\.local/bin' "$config_file" 2>/dev/null; then
|
||||
log_info "Adding ~/.local/bin to PATH in $config_file..."
|
||||
local path_content='export PATH="$HOME/.local/bin:$PATH"'
|
||||
inject_block "$config_file" "local-bin path" "$path_content"
|
||||
fi
|
||||
|
||||
log_info "Adding starship initialization to $config_file..."
|
||||
local content
|
||||
content="eval \"\$(starship init $shell_name)\""
|
||||
local content='eval "$(starship init bash)"'
|
||||
|
||||
inject_block "$config_file" "starship init" "$content"
|
||||
|
||||
# Source if modified (only for bashrc)
|
||||
if [ "$config_file" = "$HOME/.bashrc" ]; then
|
||||
. "$config_file" 2>/dev/null || true
|
||||
fi
|
||||
done
|
||||
# Source to apply changes in the current context
|
||||
. "$config_file" 2>/dev/null || true
|
||||
fi
|
||||
}
|
||||
|
||||
main() {
|
||||
|
||||
@@ -66,14 +66,8 @@ configure_shell() {
|
||||
IFS=' ' read -ra target_files <<< "$(get_shell_configs)"
|
||||
|
||||
for config_file in "${target_files[@]}"; do
|
||||
local shell_name="bash"
|
||||
if [[ "$config_file" == *".zshrc" ]]; then
|
||||
shell_name="zsh"
|
||||
fi
|
||||
|
||||
log_info "Adding zoxide initialization to $config_file..."
|
||||
local content
|
||||
content="eval \"\$(zoxide init --cmd cd $shell_name)\""
|
||||
local content="eval \"\$(zoxide init --cmd cd bash)\""
|
||||
|
||||
inject_block "$config_file" "zoxide init" "$content"
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ fi
|
||||
get_shell_configs() {
|
||||
local target_files=()
|
||||
[ -f "$HOME/.bashrc" ] && target_files+=("$HOME/.bashrc")
|
||||
[ -f "$HOME/.zshrc" ] && target_files+=("$HOME/.zshrc")
|
||||
echo "${target_files[@]}"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user