aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xinstall.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/install.sh b/install.sh
index b5a7b38..31051b2 100755
--- a/install.sh
+++ b/install.sh
@@ -42,6 +42,8 @@ COMMANDS
install [CONFIG ...]
install configurations. if none are provided,
a selection menu is showm.
+ add PATH
+ Add PATH to managed configs
hk
perform housekeeping functions
EOF
@@ -64,6 +66,25 @@ case $CMD in
housekeeping;;
hk)
housekeeping;;
+ add)
+ test -e "$1" || fail 1 "Target file not found: $1"
+
+ TARGET=$(realpath "--relative-to=$HOME" "$1")
+ NAME=$(basename "$TARGET")
+ RELPATH=$(dirname "$TARGET")
+
+ # NOTE: This does not check SETS. Could be a problem
+ test -n "${CONFIGS[$NAME]}" && fail 1 "An object with the same name is already managed."
+
+ cp -r "$1" ./ || fail 1 "Failed to copy configuration"
+ echo "$NAME;$RELPATH" >> config.csv
+ # This would need a reload
+ #choose_target "$NAME"
+
+ echo "Config was isntalled successfully."
+ echo "It can now be installed with $0 install $NAME"
+ echo "The following files were changed: config.csv $NAME"
+ ;;
*)
echo Invalid command: "$CMD"
exit 1