6 ## The defaults can be assumed if these are not set
8 ## The command name may be different from the package name
9 ## (i.e. golang => go, rustlang => cargo, ripgrep => rg)
10 ## Note: $HOME may contain special characters and should alway be quoted
14 ## Some of these directories may be the same, in some cases
15 #pkg_dst="$HOME/.local/opt/xmpl"
16 #pkg_dst_bin="$HOME/.local/opt/xmpl/bin"
17 #pkg_dst_cmd="$HOME/.local/opt/xmpl/bin/xmpl"
19 #pkg_src="$HOME/.local/opt/xmpl-v$WEBI_VERSION"
20 #pkg_src_bin="$HOME/.local/opt/xmpl-v$WEBI_VERSION/bin"
21 #pkg_src_cmd="$HOME/.local/opt/xmpl-v$WEBI_VERSION/bin/xmpl"
23 # Different packages represent the version in different ways
24 # ex: node v12.8.0 (leading 'v')
25 # ex: go1.14 (no space, nor trailing '.0's)
26 # ex: flutter 1.17.2 (plain)
27 pkg_format_cmd_version() {
29 echo "$pkg_cmd_name v$my_version"
32 # The version info should be reduced to a sortable version, without any leading characters
33 # (i.e. v12.8.0 => 12.8.0, go1.14 => 1.14, 1.12.13+hotfix => 1.12.13+hotfix)
34 pkg_get_current_version() {
35 echo "$(xmpl --version 2>/dev/null | head -n 1 | cut -d' ' -f2)"
38 # For (re-)linking to the desired installed version
39 # (for example: 'go' is special and needs both $HOME/go and $HOME/.local/opt/go)
40 # (others like 'rg', 'hugo', and 'caddy' are single files that just get replaced)
43 ln -s "$pkg_src" "$pkg_dst"
47 # web_* are defined in _webi/template.sh at https://github.com/webinstall/packages
49 # if selected version is installed, re-link it and quit
52 # will save to ~/Downloads/$WEBI_PKG_FILE by default
55 # supported formats (.xz, .tar.*, .zip) will be extracted to $WEBI_TMP
59 # For installing from the extracted package tmp directory
61 # remove the versioned folder, just in case it's there with junk
64 # rename the entire extracted folder to the new location
65 # (this will be "$HOME/.local/opt/xmpl-v$WEBI_VERSION" by default)
66 mv ./"$pkg_cmd_name"* "$pkg_src"
69 # For updating PATHs and installing companion tools
73 # web_path_add is defined in _webi/template.sh at https://github.com/webinstall/packages
74 webi_path_add "$pkg_dst_bin"
78 echo "Installed 'example' as 'xmpl' at $pkg_dst_cmd"