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