summary refs log tree commit diff stats
path: root/user/adopt
diff options
context:
space:
mode:
authorAlan Pearce2019-10-02 16:55:23 +0200
committerAlan Pearce2019-10-02 16:55:23 +0200
commitec7f1357d16ff2f4aa7430a2940a0b9519018595 (patch)
tree28f4b022aff0ec38e7891ec677703a074dfd89f8 /user/adopt
parent8a65ab00b625139984aeb6c3a1a93f8bc9d3fc85 (diff)
parenta261579a74bc3bf9ec673ef190f1ec4bb625b86b (diff)
downloadnixfiles-ec7f1357d16ff2f4aa7430a2940a0b9519018595.tar.lz
nixfiles-ec7f1357d16ff2f4aa7430a2940a0b9519018595.tar.zst
nixfiles-ec7f1357d16ff2f4aa7430a2940a0b9519018595.zip
Add 'user/' from commit 'a261579a74bc3bf9ec673ef190f1ec4bb625b86b'
git-subtree-dir: user
git-subtree-mainline: 8a65ab00b625139984aeb6c3a1a93f8bc9d3fc85
git-subtree-split: a261579a74bc3bf9ec673ef190f1ec4bb625b86b
Diffstat (limited to 'user/adopt')
-rwxr-xr-xuser/adopt29
1 files changed, 29 insertions, 0 deletions
diff --git a/user/adopt b/user/adopt
new file mode 100755
index 00000000..8e7bf4ff
--- /dev/null
+++ b/user/adopt
@@ -0,0 +1,29 @@
+#!/bin/sh
+DOTFILES_DIR=$(dirname $0)
+STOW="$DOTFILES_DIR/stow"
+
+if [ "$#" -lt 2 ]
+then
+  echo "usage: $(basename $0) tag file-to-adopt"
+  exit 1
+fi
+
+if [ -d $2 ]
+then
+  TARGET="$DOTFILES_DIR/$1/$2"
+  if ! [ -d $TARGET ]
+  then
+    mkdir -p $TARGET
+  fi
+  mv $2/* $TARGET
+  $STOW $1
+elif [ -f $2 ]
+then
+  TARGET="$DOTFILES_DIR/$1/$(dirname $2)"
+  if ! [ -d $TARGET ]
+  then
+    mkdir -p $TARGET
+  fi
+  mv $2 $TARGET
+  $STOW $1
+fi