Skip to content

Commit 0ed02ad

Browse files
committed
Improve clarity of console output
1 parent eede3e5 commit 0ed02ad

2 files changed

Lines changed: 20 additions & 18 deletions

File tree

Compile-SourceScript.ps1

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ function Compile-SourceScript {
101101

102102
if ($compiledDirItemsDiff) {
103103
# List successfully compiled plugins
104-
"`nCompiled plugins:" | Write-Host -ForegroundColor Green
104+
"`nNewly compiled plugins:" | Write-Host -ForegroundColor Cyan
105105
$compiledDirItemsDiff | % {
106106
$compiledPluginHash = (Get-FileHash $_.FullName -Algorithm MD5).Hash
107107
" $($_.Name), $($_.LastWriteTime), $compiledPluginHash" | Write-Host -ForegroundColor Green
@@ -113,16 +113,17 @@ function Compile-SourceScript {
113113
"`nThe scripts name does not match the compiled plugin's name." | Write-Host -ForegroundColor Magenta
114114
return # continue in %
115115
}
116+
"`n$($_.Name):" | Write-Host -ForegroundColor Green
116117
$existingPlugin = Get-Item "$pluginsDir/$($_.Name)" -ErrorAction SilentlyContinue
117118
if (!$existingPlugin) {
118-
"`nPlugin does not currently exist in the plugins directory." | Write-Host -ForegroundColor Yellow
119+
" Plugin does not currently exist in the plugins directory." | Write-Host -ForegroundColor Yellow
119120
}else {
120-
# Display the compiled and existing plugin's file info
121-
$compiledPluginHash = (Get-FileHash $_.FullName -Algorithm MD5).Hash
122121
$existingPluginHash = (Get-FileHash $existingPlugin -Algorithm MD5).Hash
123-
"`nExisting plugin: $($existingPlugin.Name), $($existingPlugin.LastWriteTime), $existingPluginHash" | Write-Host -ForegroundColor Yellow
124-
"Compiled plugin: $($_.Name), $($_.LastWriteTime), $compiledPluginHash" | Write-Host -ForegroundColor Green
122+
" Existing: $($existingPlugin.LastWriteTime), $existingPluginHash" | Write-Host -ForegroundColor Yellow
125123
}
124+
# Display the compiled and existing plugin's file info
125+
$compiledPluginHash = (Get-FileHash $_.FullName -Algorithm MD5).Hash
126+
" Compiled: $($_.LastWriteTime), $compiledPluginHash" | Write-Host -ForegroundColor Green
126127

127128
# Attempt to copy the compiled plugin to the plugins folder
128129
Copy-Item -Path $_.FullName -Destination $pluginsDir -Recurse @copyParams
@@ -131,11 +132,11 @@ function Compile-SourceScript {
131132
# Alert the user on the situation of the plugin
132133
$updatedPlugin = Get-Item "$pluginsDir/$($_.Name)"
133134
$updatedPluginHash = (Get-FileHash $updatedPlugin -Algorithm MD5).Hash
134-
if ($updatedPluginHash -eq $compiledPluginHash) { "Plugin successfully copied to $($_.Fullname)" | Write-Host -ForegroundColor Green }
135-
else { "Plugin has not been copied." | Write-Host -ForegroundColor Magenta; return }
135+
if ($updatedPluginHash -eq $compiledPluginHash) { "`nPlugin successfully copied to $($_.Fullname)" | Write-Host -ForegroundColor Green }
136+
else { "`nPlugin not copied." | Write-Host -ForegroundColor Magenta; return }
136137
}
137138
}else {
138-
"`nNo new/updated plugins found. No operations were performed." | Write-Host -ForegroundColor Magenta
139+
"`nNo newly compiled plugins found. No operations were performed." | Write-Host -ForegroundColor Magenta
139140
}
140141
}catch {
141142
throw "Runtime error. Exception: $($_.Exception.Message)"

module/Compile-SourceScript/Compile-SourceScript.psm1

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ function Compile-SourceScript {
9393

9494
if ($compiledDirItemsDiff) {
9595
# List successfully compiled plugins
96-
"`nCompiled plugins:" | Write-Host -ForegroundColor Green
96+
"`nNewly compiled plugins:" | Write-Host -ForegroundColor Cyan
9797
$compiledDirItemsDiff | % {
9898
$compiledPluginHash = (Get-FileHash $_.FullName -Algorithm MD5).Hash
9999
" $($_.Name), $($_.LastWriteTime), $compiledPluginHash" | Write-Host -ForegroundColor Green
@@ -105,16 +105,17 @@ function Compile-SourceScript {
105105
"`nThe scripts name does not match the compiled plugin's name." | Write-Host -ForegroundColor Magenta
106106
return # continue in %
107107
}
108+
"`n$($_.Name):" | Write-Host -ForegroundColor Green
108109
$existingPlugin = Get-Item "$pluginsDir/$($_.Name)" -ErrorAction SilentlyContinue
109110
if (!$existingPlugin) {
110-
"`nPlugin does not currently exist in the plugins directory." | Write-Host -ForegroundColor Yellow
111+
" Plugin does not currently exist in the plugins directory." | Write-Host -ForegroundColor Yellow
111112
}else {
112-
# Display the compiled and existing plugin's file info
113-
$compiledPluginHash = (Get-FileHash $_.FullName -Algorithm MD5).Hash
114113
$existingPluginHash = (Get-FileHash $existingPlugin -Algorithm MD5).Hash
115-
"`nExisting plugin: $($existingPlugin.Name), $($existingPlugin.LastWriteTime), $existingPluginHash" | Write-Host -ForegroundColor Yellow
116-
"Compiled plugin: $($_.Name), $($_.LastWriteTime), $compiledPluginHash" | Write-Host -ForegroundColor Green
114+
" Existing: $($existingPlugin.LastWriteTime), $existingPluginHash" | Write-Host -ForegroundColor Yellow
117115
}
116+
# Display the compiled and existing plugin's file info
117+
$compiledPluginHash = (Get-FileHash $_.FullName -Algorithm MD5).Hash
118+
" Compiled: $($_.LastWriteTime), $compiledPluginHash" | Write-Host -ForegroundColor Green
118119

119120
# Attempt to copy the compiled plugin to the plugins folder
120121
Copy-Item -Path $_.FullName -Destination $pluginsDir -Recurse @copyParams
@@ -123,11 +124,11 @@ function Compile-SourceScript {
123124
# Alert the user on the situation of the plugin
124125
$updatedPlugin = Get-Item "$pluginsDir/$($_.Name)"
125126
$updatedPluginHash = (Get-FileHash $updatedPlugin -Algorithm MD5).Hash
126-
if ($updatedPluginHash -eq $compiledPluginHash) { "Plugin successfully copied to $($_.Fullname)" | Write-Host -ForegroundColor Green }
127-
else { "Plugin has not been copied." | Write-Host -ForegroundColor Magenta; return }
127+
if ($updatedPluginHash -eq $compiledPluginHash) { "`nPlugin successfully copied to $($_.Fullname)" | Write-Host -ForegroundColor Green }
128+
else { "`nPlugin not copied." | Write-Host -ForegroundColor Magenta; return }
128129
}
129130
}else {
130-
"`nNo new/updated plugins found. No operations were performed." | Write-Host -ForegroundColor Magenta
131+
"`nNo newly compiled plugins found. No operations were performed." | Write-Host -ForegroundColor Magenta
131132
}
132133
}catch {
133134
throw "Runtime error. Exception: $($_.Exception.Message)"

0 commit comments

Comments
 (0)