Skip to content

Commit 3a0713e

Browse files
committed
✨ [feat] Add -All and -WaitForInput parameters to cycle through colorscripts
Introduces new functionality to display all available colorscripts sequentially with optional manual control 🎬 **Core Features:** - Adds `-All` parameter to cycle through all colorscripts in alphabetical order - Adds `-WaitForInput` parameter to pause between each script and wait for spacebar input - Supports 'q' key to quit early when cycling through scripts - Integrates with existing `-Category` and `-Tag` filters to show subset of scripts - Displays progress counter showing current script number and total count **Implementation Details:** - Creates new 'All' parameter set in Show-ColorScript function 📂 - Implements dual-mode progression: continuous auto-advance with slight delay, or manual spacebar-controlled stepping ⏯️ - Retrieves filtered script list using Get-ColorScriptEntry or Get-ColorScriptInventory depending on filter presence - Respects existing `-NoCache` flag during cycling to allow cache bypass if needed - Renders each script using standard rendering pipeline (cache-aware when possible) - Shows user-friendly prompts indicating available controls (spacebar/q keys) 🎮 **UI/UX Enhancements:** - Clears screen before each script display for clean presentation - Shows formatted progress indicator with cyan/green color coding - Displays helpful instructions based on mode (auto or manual) - Provides visual feedback during spacebar input prompt **Documentation Updates:** - Updates help documentation with new parameter descriptions - Adds three new usage examples showing different cycling scenarios 📚 - Documents parameter sets and accepted values - Explains keyboard controls for interactive mode **File Housekeeping:** - Removes trailing blank lines from 60+ colorscript files to maintain consistency 🧹 - Cleans up whitespace in unused and oversized ANSI art files **Script Analysis Tool Enhancement:** - Extends Analyze-UnusedAnsiFiles.ps1 with new filtering capabilities - Adds `-ExcludeRegularAscii` flag to filter out text-only files without extended ASCII art - Adds `-AsciiCharLimit` parameter to exclude text-heavy files (artist info, copyright notices) - Implements character counting helper to distinguish art vs. text content - Provides better categorization in analysis results distinguishing between oversized, ASCII-only, and error files Signed-off-by: Nick2bad4u <20943337+Nick2bad4u@users.noreply.github.com>
1 parent a9938ef commit 3a0713e

259 files changed

Lines changed: 5389 additions & 162 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

ColorScripts-Enhanced/ColorScripts-Enhanced.psm1

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1796,6 +1796,9 @@ function Show-ColorScript {
17961796
Name values accept wildcards; when multiple scripts match the provided pattern, the first
17971797
alphabetical match is displayed and can be inspected with -PassThru.
17981798
1799+
Use -All to cycle through all colorscripts in alphabetical order.
1800+
Combine with -WaitForInput to pause between each script (press spacebar to continue).
1801+
17991802
.PARAMETER Name
18001803
The name of the colorscript to display (without .ps1 extension). Supports wildcards for partial matches.
18011804
@@ -1805,6 +1808,13 @@ function Show-ColorScript {
18051808
.PARAMETER Random
18061809
Display a random colorscript (default behavior).
18071810
1811+
.PARAMETER All
1812+
Cycle through all available colorscripts in alphabetical order.
1813+
1814+
.PARAMETER WaitForInput
1815+
When used with -All, pause after each colorscript and wait for spacebar to continue.
1816+
Press 'q' to quit early.
1817+
18081818
.PARAMETER NoCache
18091819
Bypass cache and execute script directly.
18101820
.PARAMETER Category
@@ -1835,6 +1845,18 @@ function Show-ColorScript {
18351845
.EXAMPLE
18361846
scs hearts
18371847
Uses the alias to display the hearts colorscript.
1848+
1849+
.EXAMPLE
1850+
Show-ColorScript -All
1851+
Displays all colorscripts in alphabetical order continuously.
1852+
1853+
.EXAMPLE
1854+
Show-ColorScript -All -WaitForInput
1855+
Displays all colorscripts one at a time, waiting for spacebar press between each.
1856+
1857+
.EXAMPLE
1858+
Show-ColorScript -All -Category Nature -WaitForInput
1859+
Cycles through all nature-themed colorscripts with manual progression.
18381860
#>
18391861
[CmdletBinding(DefaultParameterSetName = 'Random')]
18401862
[Alias('scs')]
@@ -1853,6 +1875,12 @@ function Show-ColorScript {
18531875
[Parameter(ParameterSetName = 'Random')]
18541876
[switch]$Random,
18551877

1878+
[Parameter(ParameterSetName = 'All')]
1879+
[switch]$All,
1880+
1881+
[Parameter(ParameterSetName = 'All')]
1882+
[switch]$WaitForInput,
1883+
18561884
[Parameter()]
18571885
[switch]$NoCache,
18581886

@@ -1886,6 +1914,99 @@ function Show-ColorScript {
18861914
return
18871915
}
18881916

1917+
# Handle -All parameter to cycle through all colorscripts
1918+
if ($All) {
1919+
# Get all colorscripts (with optional filters)
1920+
$needsMetadata = ($Category -and $Category.Count -gt 0) -or ($Tag -and $Tag.Count -gt 0)
1921+
$allScripts = if ($needsMetadata) {
1922+
Get-ColorScriptEntry -Category $Category -Tag $Tag
1923+
}
1924+
else {
1925+
Get-ColorScriptInventory
1926+
}
1927+
1928+
if (-not $allScripts -or $allScripts.Count -eq 0) {
1929+
Write-Warning "No colorscripts found matching the specified criteria."
1930+
return
1931+
}
1932+
1933+
# Sort alphabetically
1934+
$sortedScripts = $allScripts | Sort-Object Name
1935+
$totalCount = $sortedScripts.Count
1936+
$currentIndex = 0
1937+
1938+
Write-Host "`nDisplaying $totalCount colorscripts..." -ForegroundColor Cyan
1939+
if ($WaitForInput) {
1940+
Write-Host "Press [Spacebar] to continue to next, [Q] to quit`n" -ForegroundColor Yellow
1941+
}
1942+
else {
1943+
Write-Host "Displaying continuously (Ctrl+C to stop)`n" -ForegroundColor Yellow
1944+
}
1945+
1946+
foreach ($script in $sortedScripts) {
1947+
$currentIndex++
1948+
1949+
# Clear screen and show progress
1950+
Clear-Host
1951+
Write-Host "[$currentIndex/$totalCount] " -NoNewline -ForegroundColor Green
1952+
Write-Host $script.Name -ForegroundColor Cyan
1953+
Write-Host ("=" * 60) -ForegroundColor DarkGray
1954+
Write-Host ""
1955+
1956+
# Display the colorscript
1957+
$renderedOutput = $null
1958+
if (-not $NoCache) {
1959+
Initialize-CacheDirectory
1960+
$cacheState = Get-CachedOutput -ScriptPath $script.Path
1961+
if ($cacheState.Available) {
1962+
$renderedOutput = $cacheState.Content
1963+
}
1964+
else {
1965+
$cacheResult = Build-ScriptCache -ScriptPath $script.Path
1966+
$renderedOutput = $cacheResult.StdOut
1967+
}
1968+
}
1969+
else {
1970+
$executionResult = Invoke-ColorScriptProcess -ScriptPath $script.Path
1971+
$renderedOutput = $executionResult.StdOut
1972+
}
1973+
1974+
if ($renderedOutput) {
1975+
Invoke-WithUtf8Encoding -ScriptBlock {
1976+
param($text)
1977+
Write-RenderedText -Text $text
1978+
} -Arguments @($renderedOutput)
1979+
}
1980+
1981+
# Wait for input if requested
1982+
if ($WaitForInput -and $currentIndex -lt $totalCount) {
1983+
Write-Host ""
1984+
Write-Host "Press [Spacebar] for next, [Q] to quit..." -NoNewline -ForegroundColor Yellow
1985+
1986+
$continueLoop = $true
1987+
while ($continueLoop) {
1988+
$key = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')
1989+
if ($key.VirtualKeyCode -eq 32) { # Spacebar
1990+
$continueLoop = $false
1991+
}
1992+
elseif ($key.Character -eq 'q' -or $key.Character -eq 'Q') {
1993+
Write-Host "`nQuitting..." -ForegroundColor Yellow
1994+
return
1995+
}
1996+
}
1997+
Write-Host "" # Clear the prompt line
1998+
}
1999+
elseif (-not $WaitForInput -and $currentIndex -lt $totalCount) {
2000+
# Small delay between scripts when auto-advancing
2001+
Start-Sleep -Milliseconds 100
2002+
}
2003+
}
2004+
2005+
Write-Host "`n" -NoNewline
2006+
Write-Host "Finished displaying all $totalCount colorscripts!" -ForegroundColor Green
2007+
return
2008+
}
2009+
18892010
# Optimization: Skip metadata loading if no filters are specified
18902011
# This dramatically improves performance for simple Show-ColorScript calls
18912012
$needsMetadata = ($Category -and $Category.Count -gt 0) -or ($Tag -and $Tag.Count -gt 0) -or $PassThru.IsPresent
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Converted from: 1998 - 01 - FEV-ICE.ans
2+
# Conversion date: 2025-10-25T04:46:40.349Z
3+
4+
Write-Host @"
5+
6+
 ▄▄
7+
░ ▌█ ▀█▓ █▀▀▓▓ █▀▀▓▓ █▀▀▓▓
8+
░ ▄▄▄▀ ██ █▓ █▄▄█▓ █▄▄▓▓ █▄▄▓▓
9+
 ▄▄▀▀▀ ▐░▄ ██ ▀▀ ▓▓ ▓ ▀▀
10+
▄ ▀ ▄▄▄▄ ▄▄▀▄▄▄▀▀▀  █▓▄▄▄ ▄▄▄▄███▀ ▄▄▄ ░░░░░░
11+
 ▀ ▀ ▀▓█▓▓▀  ▀█ ░░▌ ████░▀█▄█▀▀ ▄███▓ ▐██▓█▓▓▀ ▐█░░██▀▀▀ ▓▀▀ ▀██▀▀░
12+
░░▄███▓ ░▓▄▄█ ▌▐█▌█▒█▓▓███ ▓████▓ ▐█▓▒█▓ █▄ ▐██▄▄▓░ ▄▄▄▄██████░░
13+
░░░███▓ ▐▄█▄▄▄▌▐█▓█▀▀▀█▌█ ▓█████▌ ░█▄▓▓▌ ▐█ ▐░▄▀▓▄▓ ██████████░░
14+
░░▓███▓ ▐█▄▓██ ▓ ▀▄▄▄▄▄▄ ▀██████▌ ▀▀ ▄▄▄▄██▌ ▐█▓██▌ ██████████░░
15+
░░▓███▄ ▄▄████▌░ ▄▓▓███▌ ██████████████████ ▐▓███▄▄ █░░███████░░
16+
░░▓███▄ ▄▄▒█▓▓ ██▄▓▄▓▓▓▌ ████░░░░█████████▓▌ ▓▓▓█▄▄▄▄ ████████░░
17+
░░▓███▓ ▓█▓▓▓ █▄ ▀▀▀  ▀▀███▀▀▀▀█ ▄▄▄ ▀▓▓▌ ▓▒▓██ ▄████████░░
18+
░░▓███▓ ▓█▀▀ ▄░ ▓ ▀█▄▄▄ ▀▀▄▄ ▀ ▀▓▓▌ ▐▓▓▓ ▀ ░▄ ▀▀▓▓ ▀▀▀▀████░░
19+
░░▓███▄ ▀▀▄░░░▄▄ ▀▀▓▄ ▀░▄ ▓▀█▄▓▀▀ ▄▄░░░▄▀▀ ▀▀▀▀ ████▄ ▄   ▄
20+
░░░░░░ ▀▀▀▀ ▀   ▀  ░▌ ▓▓▀   ▀ ▀▀▀▀▀ ▀
21+
 ▀▄ ■ ▐█▌▐ ▄▀ ░
22+
▄▓▌  ▀▓▌ ▐▓▄  
23+
░░▀▀ ▀▀░░
24+
ice
25+
"@

0 commit comments

Comments
 (0)