fix CRLF line endings, enforce LF via .gitattributes

This commit is contained in:
Jonas H
2026-02-27 22:51:07 +01:00
parent 8464813df4
commit 074701f983
3 changed files with 16 additions and 65 deletions

1
.gitattributes vendored Normal file
View File

@@ -0,0 +1 @@
* text=auto eol=lf

50
dot-add
View File

@@ -1,50 +0,0 @@
#!/usr/bin/env bash
# dot-add: Move config files/dirs into the dotfiles repo and stow them.
#
# Usage: dot-add <package> <path> [<path> ...]
#
# Examples:
# dot-add sway ~/.config/sway/config
# dot-add sway ~/.config/sway/
# dot-add sway ~/.config/sway/*
set -euo pipefail
DOTFILES_DIR="$(cd "$(dirname "$0")" && pwd)"
if [[ $# -lt 2 ]]; then
echo "Usage: dot-add <package> <path> [<path> ...]"
exit 1
fi
PACKAGE="$1"
shift
add_one() {
local FILE
FILE="$(realpath "$1")"
if [[ ! -e "$FILE" ]]; then
echo "Error: '$FILE' does not exist" >&2
return 1
fi
if [[ ! "$FILE" == "$HOME/"* ]]; then
echo "Error: '$FILE' is not under \$HOME" >&2
return 1
fi
local REL="${FILE#$HOME/}"
local DEST="$DOTFILES_DIR/$PACKAGE/$REL"
mkdir -p "$(dirname "$DEST")"
mv "$FILE" "$DEST"
echo "Moved: $FILE -> $DEST"
}
for PATH_ARG in "$@"; do
add_one "$PATH_ARG"
done
stow --dir="$DOTFILES_DIR" --target="$HOME" --restow "$PACKAGE"
echo "Stowed: $PACKAGE"

View File

@@ -1,15 +1,15 @@
#!/usr/bin/env bash
# install.sh: Stow all packages in this dotfiles repo.
# Run this after cloning on a new machine.
set -euo pipefail
DOTFILES_DIR="$(cd "$(dirname "$0")" && pwd)"
for PACKAGE in "$DOTFILES_DIR"/*/; do
PACKAGE="$(basename "$PACKAGE")"
echo "Stowing: $PACKAGE"
stow --dir="$DOTFILES_DIR" --target="$HOME" --restow "$PACKAGE"
done
echo "Done."
#!/usr/bin/env bash
# install.sh: Stow all packages in this dotfiles repo.
# Run this after cloning on a new machine.
set -euo pipefail
DOTFILES_DIR="$(cd "$(dirname "$0")" && pwd)"
for PACKAGE in "$DOTFILES_DIR"/*/; do
PACKAGE="$(basename "$PACKAGE")"
echo "Stowing: $PACKAGE"
stow --dir="$DOTFILES_DIR" --target="$HOME" --restow "$PACKAGE"
done
echo "Done."