3 function __init_shellcheck() {
11 # Every package should define these 6 variables
12 pkg_cmd_name="shellcheck"
14 pkg_dst_cmd="$HOME/.local/bin/shellcheck"
15 pkg_dst="$pkg_dst_cmd"
17 pkg_src_cmd="$HOME/.local/opt/shellcheck-v$WEBI_VERSION/bin/shellcheck"
18 pkg_src_dir="$HOME/.local/opt/shellcheck-v$WEBI_VERSION"
19 pkg_src="$pkg_src_cmd"
21 # pkg_install must be defined by every package
23 # ~/.local/opt/shellcheck-v0.99.9/bin
24 mkdir -p "$(dirname $pkg_src_cmd)"
26 # mv ./shellcheck-*/shellcheck ~/.local/opt/shellcheck-v0.99.9/bin/shellcheck
27 mv ./shellcheck-*/shellcheck "$pkg_src_cmd"
30 # pkg_get_current_version is recommended, but (soon) not required
31 pkg_get_current_version() {
32 # 'shellcheck --version' has output in this format:
33 # ShellCheck - shell script analysis tool
35 # license: GNU General Public License, version 3
36 # website: https://www.shellcheck.net
38 # This trims it down to just the version number:
40 echo $(shellcheck --version 2> /dev/null | head -n 2 | tail -n 1 | cut -d' ' -f 2)