dotfiles/home/.local/bin/scripts/cli/dot-put

16 lines
269 B
Plaintext
Raw Normal View History

2024-02-17 21:50:24 +00:00
#!/bin/bash
set -euo pipefail
dotdir="$HOME/dots"
dothome="$dotdir/home"
dotroot="$dotdir/root"
syspath="$(realpath "$1")"
if [[ "$syspath" == "$HOME"* ]]; then
dotpath="${syspath/#$HOME/$dothome}"
else
dotpath="$dotroot$syspath"
fi
cp -vi "$syspath" "$dotpath"