Command to sync config

This commit is contained in:
Brieuc Dubois 2024-03-10 18:35:10 +01:00
parent 70c10dd25f
commit c9efd5a852
1 changed files with 21 additions and 1 deletions

View File

@ -37,4 +37,24 @@ cat() {
unsetopt BEEP 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
}