diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..6313b56 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto eol=lf diff --git a/dot-add b/dot-add index 811b224..e69de29 100755 --- a/dot-add +++ b/dot-add @@ -1,50 +0,0 @@ -#!/usr/bin/env bash -# dot-add: Move config files/dirs into the dotfiles repo and stow them. -# -# Usage: dot-add [ ...] -# -# 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 [ ...]" - 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" diff --git a/install.sh b/install.sh index 2d2091c..1dd900a 100755 --- a/install.sh +++ b/install.sh @@ -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."