summaryrefslogtreecommitdiff
path: root/util
blob: 8f39336a3d0b78df9143a41ed0b105aeee6f2459 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/zsh

set -o shwordsplit

target="$HOME/personal"

log() {
    if [[ $dry == "1" ]]; then
        echo "[DRY_RUN]: $@"
    else
        echo "$@"
    fi
}

execute() {
    log "execute $@"
    if [[ $dry == "1" ]]; then
        return
    fi
    "$@"
}

copy_dir() {
    from=$1
    to=$2
    name=$(basename $from)

    execute rm -rf $to/$name
    execute cp -r $from $to/$name
}

copy_file() {
    from=$1
    to=$2
    name=$(basename $from)

    execute rm $to/$name
    execute cp $from $to/$name
}