-
Notifications
You must be signed in to change notification settings - Fork 1
/
finstall.sh
executable file
·56 lines (52 loc) · 1.47 KB
/
finstall.sh
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
#!/usr/bin/env fish
set -l userBin ~/bin
set -l execName "fchenv"
set -l execScript $execName".sh"
set -l autocompleteScript $execName".fish"
function checkLink
if not test -L /usr/local/bin/$execName
if yesno "Create link in '/usr/local/bin' (sudo required) ?"
sudo ln -s $userBin/$execName /usr/local/bin/$execName
else
echo "Link creation skipped."
end
end
end
# copy fchenv
if not test -d $userBin
mkdir ~/bin
end
if not test -f "$userBin/$execName"
echo "copy '$execName' to $userBin"
cp $execScript ~/bin/$execName
checkLink
else
if not diff -y -q ./$execScript $userBin/$execName
if yesno "Show differencies?"
diff ./$execScript $userBin/$execName
end
if yesno "Do you want to create $execName?"
cp ./$execScript $userBin/$execName
echo "$execName copied."
checkLink
else
echo "$execName skipped."
end
else
echo "$execName is the latest."
end
if not diff -y -q ./completions/$autocompleteScript $__fish_config_dir/completions/$autocompleteScript
if yesno "Show differenices?"
diff ./completions/$autocompleteScript ./__fish_config_dir/completions/$autocompleteScript
end
if yesno "Do you want to create $autocompleteScript?"
cp ./completions/$autocompleteScript $__fish_config_dir/completions/$autocompleteScript
echo "Autocompletie file $autocompleteScript copied."
checkLink
else
echo "Autocompletie file $autocompleteScript skipped."
end
else
echo "Autocompletie file $autocompleteScript is the latest."
end
end