2024-12-02 15:03:13 -05:00
|
|
|
#!/bin/zsh -Ndefgku
|
2019-01-13 00:18:35 -07:00
|
|
|
#
|
|
|
|
# script/version
|
|
|
|
# mas
|
|
|
|
#
|
2024-11-16 04:05:35 -05:00
|
|
|
# Displays the mas version.
|
2019-01-13 00:18:35 -07:00
|
|
|
#
|
|
|
|
|
2024-12-02 15:03:13 -05:00
|
|
|
. "${0:a:h}/_setup_script"
|
2024-09-30 11:28:25 -04:00
|
|
|
|
2025-01-05 08:31:09 -05:00
|
|
|
branch="${"$(git rev-parse --abbrev-ref HEAD)":/main}"
|
|
|
|
|
|
|
|
if [[ "${branch}" = HEAD ]]; then
|
|
|
|
if git merge-base --is-ancestor HEAD main; then
|
|
|
|
branch=
|
|
|
|
else
|
|
|
|
branch="${"${(@)"${(fnO)"$(git branch --format '%(ahead-behind:HEAD) %(refname:short)')"}"[1]}"##* }"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
printf $'%s%s%s\n'\
|
|
|
|
"${branch:+"${branch}-"}"\
|
2024-12-29 21:29:10 -05:00
|
|
|
"${"$(git describe --tags 2>/dev/null)"#v}"\
|
2025-01-04 01:14:54 -05:00
|
|
|
"${"$(git diff-index HEAD --;git ls-files --exclude-standard --others)":+"${MAS_DIRTY_INDICATOR-+}"}"
|