1
0
mirror of https://github.com/tw93/Mole.git synced 2026-03-24 05:30:07 +00:00

feat(version): show commit hash for nightly installs (#517)

Display commit hash in parentheses after "Nightly" channel label
to help users identify exact version when testing nightly builds.
This commit is contained in:
tw93
2026-03-03 16:51:49 +08:00
parent c8ed94698d
commit 814b3680b9
2 changed files with 37 additions and 5 deletions

15
mole
View File

@@ -99,6 +99,13 @@ get_install_channel() {
esac
}
get_install_commit() {
local channel_file="$SCRIPT_DIR/install_channel"
if [[ -f "$channel_file" ]]; then
sed -n 's/^COMMIT_HASH=\(.*\)$/\1/p' "$channel_file" | head -1
fi
}
# Background update notice
check_for_updates() {
local msg_cache="$HOME/.cache/mole/update_message"
@@ -222,7 +229,13 @@ show_version() {
printf '\nMole version %s\n' "$VERSION"
if [[ "$channel" == "nightly" ]]; then
printf 'Channel: Nightly\n'
local commit
commit=$(get_install_commit)
if [[ -n "$commit" ]]; then
printf 'Channel: Nightly (%s)\n' "$commit"
else
printf 'Channel: Nightly\n'
fi
fi
printf 'macOS: %s\n' "$os_ver"
printf 'Architecture: %s\n' "$arch"