-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdiff.sh
More file actions
executable file
·58 lines (51 loc) · 1.35 KB
/
diff.sh
File metadata and controls
executable file
·58 lines (51 loc) · 1.35 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
# Prints path to directory containing this script
function scriptDirectory {
local self_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo "$self_dir"
}
# Bring in constants
source "$(scriptDirectory)/installation/constants.sh"
# Bring in the helper functions
source "$(scriptDirectory)/installation/helperFunctions.sh"
# Bring in the application configuration util
source "$(scriptDirectory)/installation/appConfigUtil.sh"
function diff {
if cmdExists delta; then
delta "$@"
elif cmdExists git; then
git diff "$@"
else
# Invoke original command
command diff "$@"
fi
}
# Diff dot files in Mac Setup against current machine files
# to detect missing files and differences.
find_dot_file_changes() {
topLevelDotFiles=(
"bashrc"
"bash_profile"
"profile"
"zshrc"
"zprofile"
"utility_aliases"
"config_vars"
"splash_screens"
)
filesToDiff=()
for dotFileName in "${topLevelDotFiles[@]}"; do
LOCAL_FILE=~/."$dotFileName"
if [ ! -f $LOCAL_FILE ]; then
warn "Dotfile $dotFileName is not present on current machine."
else
filesToDiff+=($dotFileName)
fi
done
for dotFileName in "${filesToDiff[@]}"; do
LOCAL_FILE=~/."$dotFileName"
SETUP_FILE="$(scriptDirectory)"/Mac_Dot_Files/"$dotFileName".sh
diff $SETUP_FILE $LOCAL_FILE
done
}
find_dot_file_changes