mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-12-19 18:05:02 -07:00
6d708b2807
* Create asdf-version script to print formatted version * Update Makefile to set main.version variable during build * Improve help output formatting * Update release-build workflow to set asdf version in binaries
21 lines
563 B
Bash
Executable File
21 lines
563 B
Bash
Executable File
#!/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
|