6ae91541de66cc83d69691534d65893ffe6b5831
[webi-installers/.git] / bat / install.sh
1 #!/bin/bash
2
3 {
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 }