diff --git a/Compile.ps1 b/Compile.ps1 index f86fbce6..a7f87657 100644 --- a/Compile.ps1 +++ b/Compile.ps1 @@ -56,7 +56,16 @@ Update-Progress "Adding: Header" 5 $script_content.Add($header) Update-Progress "Adding: Version" 10 -$script_content.Add($(Get-Content "$workingdir\scripts\start.ps1").replace('#{replaceme}',"$(Get-Date -Format yy.MM.dd)")) +$commitHash = (git rev-parse HEAD).Substring(0,16) +$gitStatus = if ((git status --porcelain=v1 2>$null).Count -gt 0) { "dirty" } else { "clean" } + +$scriptPrelude = $(Get-Content "$workingdir\scripts\start.ps1") + +$scriptPrelude = $scriptPrelude -replace '#{replaceme-version}', "$(Get-Date -Format yy.MM.dd)" +$scriptPrelude = $scriptPrelude -replace '#{replaceme-commit}', "$commitHash" +$scriptPrelude = $scriptPrelude -replace '#{replaceme-gitstat}', "$gitStatus" + +$script_content.Add($scriptPrelude) Update-Progress "Adding: Functions" 20 Get-ChildItem "$workingdir\functions" -Recurse -File | ForEach-Object { diff --git a/scripts/main.ps1 b/scripts/main.ps1 index c1d476f4..2da8bff1 100644 --- a/scripts/main.ps1 +++ b/scripts/main.ps1 @@ -157,7 +157,7 @@ $sync["Form"].TaskbarItemInfo = New-Object System.Windows.Shell.TaskbarItemInfo Set-WinUtilTaskbaritem -state "None" # Set the titlebar -$sync["Form"].title = $sync["Form"].title + " " + $sync.version +$sync["Form"].title = $sync["Form"].title + " " + $sync.version + " " + $sync.commit + " " + $sync.gitstat # Set the commands that will run when the form is closed $sync["Form"].Add_Closing({ $sync.runspace.Dispose() @@ -494,6 +494,7 @@ Runspace : @DeveloperDurp MicroWin : @KonTy GitHub : ChrisTitusTech/winutil Version : $($sync.version) +Commit : $($sync.commit) ($($sync.gitstat)) "@ $FontSize = $sync.configs.themes.$ctttheme.CustomDialogFontSize $HeaderFontSize = $sync.configs.themes.$ctttheme.CustomDialogFontSizeHeader diff --git a/scripts/start.ps1 b/scripts/start.ps1 index 73693260..9d20bcd5 100644 --- a/scripts/start.ps1 +++ b/scripts/start.ps1 @@ -3,7 +3,7 @@ Author : Chris Titus @christitustech Runspace Author: @DeveloperDurp GitHub : https://github.com/ChrisTitusTech - Version : #{replaceme} + Version : #{replaceme-version} #> param ( [switch]$Debug, @@ -40,7 +40,9 @@ Add-Type -AssemblyName System.Windows.Forms # Variable to sync between runspaces $sync = [Hashtable]::Synchronized(@{}) $sync.PSScriptRoot = $PSScriptRoot -$sync.version = "#{replaceme}" +$sync.version = "#{replaceme-version}" +$sync.commit = "#{replaceme-commit}" +$sync.gitstat = "#{replaceme-gitstat}" $sync.configs = @{} $sync.ProcessRunning = $false