mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-12-24 12:25:28 -07:00
21 lines
563 B
Plaintext
21 lines
563 B
Plaintext
|
#!/usr/bin/env bash
|
||
|
|
||
|
# Unofficial Bash "strict mode"
|
||
|
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
|
||
|
set -euo pipefail
|
||
|
#ORIGINAL_IFS=$IFS
|
||
|
IFS=$'\t\n' # Stricter IFS settings
|
||
|
|
||
|
# Simpler helper script to extract the current version out of the source in the
|
||
|
# asdf Git repository.
|
||
|
|
||
|
asdf_version() {
|
||
|
local version git_rev
|
||
|
root_dir="$(dirname "$(dirname "$(realpath "$0")")")"
|
||
|
version="v$(cat "${root_dir}/version.txt")"
|
||
|
git_rev="$(git --git-dir "${root_dir}/.git" rev-parse --short HEAD)"
|
||
|
printf "%s-%s\n" "$version" "$git_rev"
|
||
|
}
|
||
|
|
||
|
asdf_version
|