Skip to content

Commit 1a4568a

Browse files
committed
Refactor output formatting in Compare-KubeSnapshots.ps1
Signed-off-by: PixelRobots <[email protected]>
1 parent 31b0588 commit 1a4568a

5 files changed

+27
-27
lines changed

CHANGELOG.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [0.0.3] - 2024-10-22
8+
9+
### Changed
10+
- **Removed ASCII Art from Output**: Replaced ASCII art in the comparison summary with cleaner, simpler text formatting to improve compatibility and readability across different terminals and UI environments.
11+
712
## [0.0.2] - 2024-10-18
813

914
### Added
@@ -19,7 +24,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1924
### Fixed
2025
- **Resource Snapshot Processing**: Unified handling of namespaced and cluster-scoped resources for consistent snapshotting and better error handling.
2126

22-
2327
## [0.0.1] - 2024-10-14
2428

2529
### Added

KubeSnapIt.psd1

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
RootModule = 'KubeSnapIt.psm1'
1313

1414
# Version number of this module.
15-
ModuleVersion = '0.0.2'
15+
ModuleVersion = '0.0.3'
1616

1717
# Supported PSEditions
1818
# CompatiblePSEditions = @()

KubeSnapIt.psm1

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ function Invoke-KubeSnapIt {
109109
return
110110
}
111111

112-
Show-KubeSnapItBanner
112+
# Show-KubeSnapItBanner
113113

114114
# Check if kubectl is installed for actions that require it
115115
if (!(Get-Command "kubectl" -ErrorAction SilentlyContinue)) {

Private/Compare-KubeSnapshots.ps1

+20-24
Original file line numberDiff line numberDiff line change
@@ -197,31 +197,27 @@ function Compare-Lines {
197197
# Add a note for whitespace representation
198198
Write-Host "`nNote: Spaces are represented as '␣' in the output." -ForegroundColor Magenta
199199

200-
# Boxed output format for the results
201-
Write-Host ""
202-
Write-Host "╔════════════════════════════════════════════════╗" -ForegroundColor Magenta
203-
Write-Host "║ Comparison Summary ║" -ForegroundColor Magenta
204-
Write-Host "╠════════════════════════════════════════════════╣" -ForegroundColor Magenta
205-
206-
if ($comparisonResults.Count -gt 0) {
207-
foreach ($result in $comparisonResults) {
208-
$lineFormatted = "Line: $($result.LineNumber)"
209-
$fileFormatted = "File: $($result.File)"
210-
$contentFormatted = "Content: $($result.Content)"
211-
$lineFormatted = $lineFormatted.PadRight($boxWidth - 4) + ""
212-
$fileFormatted = $fileFormatted.PadRight($boxWidth - 4) + ""
213-
$contentFormatted = $contentFormatted.PadRight($boxWidth - 4) + ""
214-
215-
Write-Host "$lineFormatted" -ForegroundColor Yellow
216-
Write-Host "$fileFormatted" -ForegroundColor Cyan
217-
Write-Host "$contentFormatted" -ForegroundColor Red
218-
Write-Host "" (" " * ($boxWidth - 4)) "" -ForegroundColor Magenta
219-
}
220-
Write-Host "╚════════════════════════════════════════════════╝" -ForegroundColor Magenta
221-
} else {
222-
Write-Host "║ No differences found ║" -ForegroundColor Green
223-
Write-Host "╚════════════════════════════════════════════════╝" -ForegroundColor Magenta
200+
# Simple formatted output for the results
201+
Write-Host ""
202+
Write-Host "==================== Comparison Summary ====================" -ForegroundColor Magenta
203+
204+
if ($comparisonResults.Count -gt 0) {
205+
foreach ($result in $comparisonResults) {
206+
$lineFormatted = "Line: $($result.LineNumber)"
207+
$fileFormatted = "File: $($result.File)"
208+
$contentFormatted = "Content: $($result.Content)"
209+
210+
Write-Host "------------------------------------------------------------" -ForegroundColor Magenta
211+
Write-Host "$lineFormatted" -ForegroundColor Yellow
212+
Write-Host "$fileFormatted" -ForegroundColor Cyan
213+
Write-Host "$contentFormatted" -ForegroundColor Red
224214
}
215+
Write-Host "------------------------------------------------------------" -ForegroundColor Magenta
216+
} else {
217+
Write-Host "No differences found" -ForegroundColor Green
218+
}
219+
Write-Host "============================================================" -ForegroundColor Magenta
220+
225221
}
226222

227223
function Compare-Files {
File renamed without changes.

0 commit comments

Comments
 (0)