feat: Add .gitignore and improve link script

This commit is contained in:
2025-10-20 12:40:42 +11:00
parent 692dfc6f02
commit 6fa4bc2808
2 changed files with 21 additions and 12 deletions

7
.gitignore vendored
View File

@ -1 +1,8 @@
nushell/history.txt
# Ignore application history files
**/history.txt
**/history.db
# Ignore shell history files
.zsh_history
.bash_history

View File

@ -2,6 +2,8 @@
# A script to REMOVE old broken links and CREATE correct new ones.
set -e # Exit immediately if a command exits with a non-zero status.
DOTFILES_DIR="$HOME/dotfiles"
CONFIG_DIR="$HOME/.config"
@ -19,10 +21,10 @@ for dir in "${CONFIG_DIRS[@]}"; do
LINK_PATH="$CONFIG_DIR/$dir"
echo "-> Processing $dir..."
# Remove any existing file or broken link at the destination
# Remove any existing file, directory, or broken link at the destination
rm -rf "$LINK_PATH"
# Create the new, correct symlink
ln -s "$SOURCE_PATH" "$LINK_PATH"
# Create the new, correct symlink. -T prevents nesting.
ln -sT "$SOURCE_PATH" "$LINK_PATH"
echo " Linked $SOURCE_PATH -> $LINK_PATH"
done
@ -31,7 +33,7 @@ SOURCE_PATH_STARSHIP="$DOTFILES_DIR/starship.toml"
LINK_PATH_STARSHIP="$CONFIG_DIR/starship.toml"
echo "-> Processing starship.toml..."
rm -f "$LINK_PATH_STARSHIP"
ln -s "$SOURCE_PATH_STARSHIP" "$LINK_PATH_STARSHIP"
ln -sT "$SOURCE_PATH_STARSHIP" "$LINK_PATH_STARSHIP"
echo " Linked $SOURCE_PATH_STARSHIP -> $LINK_PATH_STARSHIP"
# --- 3. Fix link for .zshrc file in ~ ---
@ -39,7 +41,7 @@ SOURCE_PATH_ZSHRC="$DOTFILES_DIR/.zshrc"
LINK_PATH_ZSHRC="$HOME/.zshrc"
echo "-> Processing .zshrc..."
rm -f "$LINK_PATH_ZSHRC"
ln -s "$SOURCE_PATH_ZSHRC" "$LINK_PATH_ZSHRC"
ln -sT "$SOURCE_PATH_ZSHRC" "$LINK_PATH_ZSHRC"
echo " Linked $SOURCE_PATH_ZSHRC -> $LINK_PATH_ZSHRC"
echo "--- All links have been reset correctly. ---"