forked from BartSte/fzf-help
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install
executable file
·51 lines (44 loc) · 1.12 KB
/
install
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
#!/usr/bin/env bash
usage() {
cat <<EOF
Usage: $0
This script will install fzf-help to /usr/share/zsh/plugins/fzf-help.
If the --bash option is given, it will install to /usr/share/fzf-help instead.
Options:
--bash Install to /usr/share/fzf-help instead of
/usr/share/zsh/plugins/fzf-help
-h, --help Show this help message
EOF
}
this_dir=$(dirname $(realpath ${BASH_SOURCE:-$0}))
plugin_dir=/usr/share/zsh/plugins/fzf-help
while [[ $# -gt 0 ]]; do
case $1 in
--bash)
plugin_dir=/usr/share/fzf-help
shift
;;
-h | --help)
usage
exit 0
;;
*)
echo "Unknown option: $1"
usage
exit 1
;;
esac
done
abort() {
echo 'installation aborted'
exit 0
}
if [[ -d $plugin_dir ]]; then
echo "Found old installation at $plugin_dir"
echo "Deleting old installation..."
sudo rm -rf $plugin_dir || abort
fi
echo "Copying fzf-help to $plugin_dir"
sudo mkdir -p $plugin_dir || abort
sudo cp $this_dir/src/* $plugin_dir || abort
echo 'Installation complete.'