From 82ab38ae7fac140f3ede8e70aebb0c0342ea7cd7 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Sat, 17 Feb 2024 22:50:24 +0100 Subject: [PATCH] Add dot-put script --- home/.local/bin/scripts/cli/dot-put | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 home/.local/bin/scripts/cli/dot-put diff --git a/home/.local/bin/scripts/cli/dot-put b/home/.local/bin/scripts/cli/dot-put new file mode 100755 index 0000000..a60725d --- /dev/null +++ b/home/.local/bin/scripts/cli/dot-put @@ -0,0 +1,15 @@ +#!/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"