chore(style): add shebang, set bash strict mode, create function
[webi-installers/.git] / hexyl / install.sh
1 #!/bin/bash
2 set -e
3 set -u
4
5 function __init_hexyl() {
6
7     ###############
8     # Install hexyl #
9     ###############
10
11     WEBI_SINGLE=true
12
13     pkg_get_current_version() {
14         # 'hexyl --version' has output in this format:
15         #       hexyl 0.8.0
16         # This trims it down to just the version number:
17         #       0.8.0
18         echo $(hexyl --version 2> /dev/null | head -n 1 | cut -d' ' -f 2)
19     }
20
21     pkg_install() {
22         # ~/.local/
23         mkdir -p "$pkg_src_bin"
24
25         # mv ./hexyl-*/hexyl ~/.local/opt/hexyl-v0.8.0/bin/hexyl
26         mv ./hexyl-*/hexyl "$pkg_src_cmd"
27
28         # chmod a+x ~/.local/opt/hexyl-v0.8.0/bin/hexyl
29         chmod a+x "$pkg_src_cmd"
30     }
31 }
32
33 __init_hexyl