Skip to content

Commit 9685a0c

Browse files
authored
Set default values for exceeding range 0-100 (#203)
1 parent 8cf5f86 commit 9685a0c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

winfetch.ps1

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,10 @@ $COLUMNS = $imgwidth
296296

297297
# ===== UTILITY FUNCTIONS =====
298298
function get_percent_bar {
299-
param ([Parameter(Mandatory)][ValidateRange(0, 100)][int]$percent)
299+
param ([Parameter(Mandatory)][int]$percent)
300+
301+
if ($percent -gt 100) { $percent = 100 }
302+
elseif ($percent -lt 0) { $percent = 0 }
300303

301304
$x = [char]9632
302305
$bar = $null

0 commit comments

Comments
 (0)