From c9efd5a85230c9c850eb82acc604d7562746dd06 Mon Sep 17 00:00:00 2001 From: Brieuc Dubois Date: Sun, 10 Mar 2024 18:35:10 +0100 Subject: [PATCH] Command to sync config --- root/home/bhasher/.zshrc | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/root/home/bhasher/.zshrc b/root/home/bhasher/.zshrc index 61e2bf0..442faef 100644 --- a/root/home/bhasher/.zshrc +++ b/root/home/bhasher/.zshrc @@ -37,4 +37,24 @@ cat() { unsetopt BEEP -alias beep="sh -c 'speaker-test -t sine -f 600 > /dev/null & sleep .5 && pkill speaker-test'" + +SCONFIG_PATH="~/Documents/sync/.config" + +alias config_sync="sh -c 'cd $SCONFIG_PATH/scripts && sudo ./sync.sh'" + +config_cp() { + src_dir=$(realpath "$1") + dest_dir="$SCONFIG_PATH/root$src_dir" + num_files=$(find "$src_dir" -type f | wc -l) + + read "REPLY?About to copy $num_files files from $src_dir -> $dest_dir. Proceed? (Y/n) " + if [[ $REPLY =~ ^[Yy]$ ]] + then + mkdir -p "$(dirname "$dest_dir")" + cp -R "$src_dir" "$dest_dir" + if [ $? -eq 0 ] + then + echo "OK" + fi + fi +}