mirror of
https://github.com/tw93/Mole.git
synced 2026-02-04 12:41:46 +00:00
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 325 KiB After Width: | Height: | Size: 309 KiB |
@@ -5,6 +5,8 @@
|
||||
param(
|
||||
[Parameter(Position = 0)]
|
||||
[string]$Path,
|
||||
|
||||
[Alias('h')]
|
||||
[switch]$ShowHelp
|
||||
)
|
||||
|
||||
@@ -19,13 +21,13 @@ $binPath = Join-Path $windowsDir "bin\analyze.exe"
|
||||
function Show-AnalyzeHelp {
|
||||
$esc = [char]27
|
||||
Write-Host ""
|
||||
Write-Host "$esc[1;35mMole Analyze$esc[0m - Interactive disk space analyzer"
|
||||
Write-Host "$esc[1;35mmo analyze$esc[0m - Interactive disk space analyzer"
|
||||
Write-Host ""
|
||||
Write-Host "$esc[33mUsage:$esc[0m mole analyze [path]"
|
||||
Write-Host "$esc[33mUsage:$esc[0m mo analyze [path]"
|
||||
Write-Host ""
|
||||
Write-Host "$esc[33mOptions:$esc[0m"
|
||||
Write-Host " [path] Path to analyze (default: user profile)"
|
||||
Write-Host " -ShowHelp Show this help message"
|
||||
Write-Host " [path] Path to analyze (default: user profile)"
|
||||
Write-Host " --help Show this help message"
|
||||
Write-Host ""
|
||||
Write-Host "$esc[33mKeybindings:$esc[0m"
|
||||
Write-Host " Up/Down Navigate entries"
|
||||
|
||||
@@ -6,6 +6,20 @@
|
||||
param(
|
||||
[Alias('dry-run')]
|
||||
[switch]$DryRun,
|
||||
|
||||
[Alias('s')]
|
||||
[switch]$System,
|
||||
|
||||
[Alias('game-media')]
|
||||
[switch]$GameMedia,
|
||||
|
||||
[Alias('d')]
|
||||
[switch]$DebugMode,
|
||||
|
||||
[Alias('w')]
|
||||
[switch]$Whitelist,
|
||||
|
||||
[Alias('h')]
|
||||
|
||||
[Alias('system')]
|
||||
[switch]$System,
|
||||
@@ -56,23 +70,23 @@ $script:ExportListFile = "$env:USERPROFILE\.config\mole\clean-list.txt"
|
||||
function Show-CleanHelp {
|
||||
$esc = [char]27
|
||||
Write-Host ""
|
||||
Write-Host "$esc[1;35mMole Clean$esc[0m - Deep cleanup for Windows"
|
||||
Write-Host "$esc[1;35mmo clean$esc[0m - Deep cleanup for Windows"
|
||||
Write-Host ""
|
||||
Write-Host "$esc[33mUsage:$esc[0m mole clean [options]"
|
||||
Write-Host "$esc[33mUsage:$esc[0m mo clean [options]"
|
||||
Write-Host ""
|
||||
Write-Host "$esc[33mOptions:$esc[0m"
|
||||
Write-Host " -DryRun Preview changes without deleting (recommended first run)"
|
||||
Write-Host " -System Include system-level cleanup (requires admin)"
|
||||
Write-Host " -GameMedia Clean old game replays, screenshots, recordings (>90d)"
|
||||
Write-Host " -Whitelist Manage protected paths"
|
||||
Write-Host " -DebugMode Enable debug logging"
|
||||
Write-Host " -ShowHelp Show this help message"
|
||||
Write-Host " --dry-run Preview changes without deleting (recommended first run)"
|
||||
Write-Host " --system Include system-level cleanup (requires admin)"
|
||||
Write-Host " --game-media Clean old game replays, screenshots, recordings (>90d)"
|
||||
Write-Host " --whitelist Manage protected paths"
|
||||
Write-Host " --debug Enable debug logging"
|
||||
Write-Host " --help Show this help message"
|
||||
Write-Host ""
|
||||
Write-Host "$esc[33mExamples:$esc[0m"
|
||||
Write-Host " mole clean -DryRun # Preview what would be cleaned"
|
||||
Write-Host " mole clean # Run standard cleanup"
|
||||
Write-Host " mole clean -GameMedia # Include old game media cleanup"
|
||||
Write-Host " mole clean -System # Include system cleanup (as admin)"
|
||||
Write-Host " mo clean --dry-run # Preview what would be cleaned"
|
||||
Write-Host " mo clean # Run standard cleanup"
|
||||
Write-Host " mo clean --game-media # Include old game media cleanup"
|
||||
Write-Host " mo clean --system # Include system cleanup (as admin)"
|
||||
Write-Host ""
|
||||
}
|
||||
|
||||
@@ -145,7 +159,7 @@ function Show-CleanupSummary {
|
||||
Write-Host " Categories: $($Stats.TotalItems)"
|
||||
Write-Host ""
|
||||
Write-Host " Detailed list: $esc[90m$($script:ExportListFile)$esc[0m"
|
||||
Write-Host " Run without -DryRun to apply cleanup"
|
||||
Write-Host " Run without --dry-run to apply cleanup"
|
||||
}
|
||||
else {
|
||||
Write-Host " Space freed: $esc[32m${sizeGB}GB$esc[0m"
|
||||
@@ -203,14 +217,14 @@ function Start-Cleanup {
|
||||
#
|
||||
# How to protect files:
|
||||
# 1. Copy any path below to $($script:Config.WhitelistFile)
|
||||
# 2. Run: mole clean -Whitelist
|
||||
# 2. Run: mo clean --whitelist
|
||||
#
|
||||
|
||||
"@
|
||||
Set-Content -Path $script:ExportListFile -Value $header
|
||||
}
|
||||
else {
|
||||
Write-Host "$esc[90m$($script:Icons.Solid) Use -DryRun to preview, -Whitelist to manage protected paths$esc[0m"
|
||||
Write-Host "$esc[90m$($script:Icons.Solid) Use --dry-run to preview, --whitelist to manage protected paths$esc[0m"
|
||||
Write-Host ""
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,11 @@
|
||||
param(
|
||||
[Alias('dry-run')]
|
||||
[switch]$DryRun,
|
||||
|
||||
[Alias('d')]
|
||||
[switch]$DebugMode,
|
||||
|
||||
[Alias('h')]
|
||||
|
||||
[Alias('debug')]
|
||||
[switch]$DebugMode,
|
||||
@@ -32,7 +37,6 @@ $libDir = Join-Path (Split-Path -Parent $scriptDir) "lib"
|
||||
# ============================================================================
|
||||
|
||||
$script:OptimizationsApplied = 0
|
||||
$script:RepairsApplied = 0
|
||||
$script:IssuesFound = 0
|
||||
$script:IssuesFixed = 0
|
||||
|
||||
@@ -43,7 +47,7 @@ $script:IssuesFixed = 0
|
||||
function Show-OptimizeHelp {
|
||||
$esc = [char]27
|
||||
Write-Host ""
|
||||
Write-Host "$esc[1;35mMole Optimize$esc[0m - System optimization and repairs"
|
||||
Write-Host "$esc[1;35mmo optimize$esc[0m - System optimization and maintenance"
|
||||
Write-Host ""
|
||||
Write-Host "$esc[33mUsage:$esc[0m mo optimize [options]"
|
||||
Write-Host ""
|
||||
@@ -63,6 +67,10 @@ function Show-OptimizeHelp {
|
||||
Write-Host " mo optimize # Run all optimizations"
|
||||
Write-Host " mo optimize --dry-run # Preview what would happen"
|
||||
Write-Host ""
|
||||
Write-Host "$esc[33mExamples:$esc[0m"
|
||||
Write-Host " mo optimize # Run all optimizations"
|
||||
Write-Host " mo optimize --dry-run # Preview what would happen"
|
||||
Write-Host ""
|
||||
}
|
||||
|
||||
# ============================================================================
|
||||
@@ -483,7 +491,7 @@ function Repair-FontCache {
|
||||
Write-Host " $esc[33m$($script:Icons.DryRun)$esc[0m Would stop Windows Font Cache Service"
|
||||
Write-Host " $esc[33m$($script:Icons.DryRun)$esc[0m Would delete font cache files"
|
||||
Write-Host " $esc[33m$($script:Icons.DryRun)$esc[0m Would restart Windows Font Cache Service"
|
||||
$script:RepairsApplied++
|
||||
$script:OptimizationsApplied++
|
||||
return
|
||||
}
|
||||
|
||||
@@ -516,7 +524,7 @@ function Repair-FontCache {
|
||||
|
||||
Write-Host " $esc[32m$($script:Icons.Success)$esc[0m Font cache rebuilt successfully"
|
||||
Write-Host " $esc[90mNote: Some apps may need restart to see changes$esc[0m"
|
||||
$script:RepairsApplied++
|
||||
$script:OptimizationsApplied++
|
||||
}
|
||||
catch {
|
||||
Write-Host " $esc[31m$($script:Icons.Error)$esc[0m Could not rebuild font cache: $_"
|
||||
@@ -544,7 +552,7 @@ function Repair-IconCache {
|
||||
Write-Host " $esc[33m$($script:Icons.DryRun)$esc[0m Would stop Explorer"
|
||||
Write-Host " $esc[33m$($script:Icons.DryRun)$esc[0m Would delete icon cache files (iconcache_*.db)"
|
||||
Write-Host " $esc[33m$($script:Icons.DryRun)$esc[0m Would restart Explorer"
|
||||
$script:RepairsApplied++
|
||||
$script:OptimizationsApplied++
|
||||
return
|
||||
}
|
||||
|
||||
@@ -579,7 +587,7 @@ function Repair-IconCache {
|
||||
|
||||
Write-Host " $esc[32m$($script:Icons.Success)$esc[0m Icon cache rebuilt ($deletedCount files cleared)"
|
||||
Write-Host " $esc[90mNote: Icons will rebuild gradually as you browse$esc[0m"
|
||||
$script:RepairsApplied++
|
||||
$script:OptimizationsApplied++
|
||||
}
|
||||
catch {
|
||||
Write-Host " $esc[31m$($script:Icons.Error)$esc[0m Could not rebuild icon cache: $_"
|
||||
@@ -612,7 +620,7 @@ function Repair-SearchIndex {
|
||||
Write-Host " $esc[33m$($script:Icons.DryRun)$esc[0m Would stop Windows Search service"
|
||||
Write-Host " $esc[33m$($script:Icons.DryRun)$esc[0m Would delete search index database"
|
||||
Write-Host " $esc[33m$($script:Icons.DryRun)$esc[0m Would restart Windows Search service"
|
||||
$script:RepairsApplied++
|
||||
$script:OptimizationsApplied++
|
||||
return
|
||||
}
|
||||
|
||||
@@ -631,7 +639,7 @@ function Repair-SearchIndex {
|
||||
|
||||
Write-Host " $esc[32m$($script:Icons.Success)$esc[0m Search index reset successfully"
|
||||
Write-Host " $esc[33m$($script:Icons.Warning)$esc[0m Indexing will rebuild in the background (may take hours)"
|
||||
$script:RepairsApplied++
|
||||
$script:OptimizationsApplied++
|
||||
}
|
||||
catch {
|
||||
Write-Host " $esc[31m$($script:Icons.Error)$esc[0m Could not reset search index: $_"
|
||||
@@ -655,7 +663,7 @@ function Repair-StoreCache {
|
||||
|
||||
if ($script:DryRun) {
|
||||
Write-Host " $esc[33m$($script:Icons.DryRun)$esc[0m Would run wsreset.exe"
|
||||
$script:RepairsApplied++
|
||||
$script:OptimizationsApplied++
|
||||
return
|
||||
}
|
||||
|
||||
@@ -670,7 +678,7 @@ function Repair-StoreCache {
|
||||
else {
|
||||
Write-Host " $esc[33m$($script:Icons.Warning)$esc[0m wsreset completed with code $($wsreset.ExitCode)"
|
||||
}
|
||||
$script:RepairsApplied++
|
||||
$script:OptimizationsApplied++
|
||||
}
|
||||
catch {
|
||||
Write-Host " $esc[31m$($script:Icons.Error)$esc[0m Could not reset Store cache: $_"
|
||||
@@ -696,12 +704,8 @@ function Show-OptimizeSummary {
|
||||
Write-Host ""
|
||||
|
||||
if ($script:DryRun) {
|
||||
$total = $script:OptimizationsApplied + $script:RepairsApplied
|
||||
Write-Host " Would apply $esc[33m$total$esc[0m changes"
|
||||
if ($script:RepairsApplied -gt 0) {
|
||||
Write-Host " ($($script:OptimizationsApplied) optimizations, $($script:RepairsApplied) repairs)"
|
||||
}
|
||||
Write-Host " Run without -DryRun to apply changes"
|
||||
Write-Host " Would apply $esc[33m$($script:OptimizationsApplied)$esc[0m optimizations"
|
||||
Write-Host " Run without --dry-run to apply changes"
|
||||
}
|
||||
else {
|
||||
Write-Host " Optimizations applied: $esc[32m$($script:OptimizationsApplied)$esc[0m"
|
||||
@@ -750,7 +754,7 @@ function Main {
|
||||
|
||||
$esc = [char]27
|
||||
Write-Host ""
|
||||
Write-Host "$esc[1;35mOptimize and Check$esc[0m"
|
||||
Write-Host "$esc[1;35mOptimize and Maintain$esc[0m"
|
||||
Write-Host ""
|
||||
|
||||
if ($script:DryRun) {
|
||||
@@ -764,7 +768,6 @@ function Main {
|
||||
|
||||
# Run optimizations
|
||||
Optimize-DiskDrive
|
||||
Optimize-SearchIndex
|
||||
Clear-DnsCache
|
||||
Optimize-Network
|
||||
|
||||
|
||||
@@ -4,6 +4,13 @@
|
||||
#Requires -Version 5.1
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Alias('d')]
|
||||
[switch]$DebugMode,
|
||||
|
||||
[Alias('p')]
|
||||
[switch]$Paths,
|
||||
|
||||
[Alias('h')]
|
||||
[Alias('debug')]
|
||||
[switch]$DebugMode,
|
||||
|
||||
@@ -79,14 +86,14 @@ $script:ItemsCleaned = 0
|
||||
function Show-PurgeHelp {
|
||||
$esc = [char]27
|
||||
Write-Host ""
|
||||
Write-Host "$esc[1;35mMole Purge$esc[0m - Clean project build artifacts"
|
||||
Write-Host "$esc[1;35mmo purge$esc[0m - Clean project build artifacts"
|
||||
Write-Host ""
|
||||
Write-Host "$esc[33mUsage:$esc[0m mole purge [options]"
|
||||
Write-Host "$esc[33mUsage:$esc[0m mo purge [options]"
|
||||
Write-Host ""
|
||||
Write-Host "$esc[33mOptions:$esc[0m"
|
||||
Write-Host " -Paths Edit custom scan directories"
|
||||
Write-Host " -DebugMode Enable debug logging"
|
||||
Write-Host " -ShowHelp Show this help message"
|
||||
Write-Host " --paths Edit custom scan directories"
|
||||
Write-Host " --debug Enable debug logging"
|
||||
Write-Host " --help Show this help message"
|
||||
Write-Host ""
|
||||
Write-Host "$esc[33mDefault Search Paths:$esc[0m"
|
||||
foreach ($path in $script:DefaultSearchPaths) {
|
||||
@@ -555,7 +562,7 @@ function Main {
|
||||
|
||||
if ($null -eq $searchPaths -or $searchPaths.Count -eq 0) {
|
||||
Write-MoleWarning "No valid search paths found"
|
||||
Write-Host "Run 'mole purge -Paths' to configure search directories"
|
||||
Write-Host "Run 'mo purge --paths' to configure search directories"
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#Requires -Version 5.1
|
||||
param(
|
||||
[Alias('h')]
|
||||
[switch]$ShowHelp
|
||||
)
|
||||
|
||||
@@ -17,12 +18,12 @@ $binPath = Join-Path $windowsDir "bin\status.exe"
|
||||
function Show-StatusHelp {
|
||||
$esc = [char]27
|
||||
Write-Host ""
|
||||
Write-Host "$esc[1;35mMole Status$esc[0m - Real-time system health monitor"
|
||||
Write-Host "$esc[1;35mmo status$esc[0m - Real-time system health monitor"
|
||||
Write-Host ""
|
||||
Write-Host "$esc[33mUsage:$esc[0m mole status"
|
||||
Write-Host "$esc[33mUsage:$esc[0m mo status"
|
||||
Write-Host ""
|
||||
Write-Host "$esc[33mOptions:$esc[0m"
|
||||
Write-Host " -ShowHelp Show this help message"
|
||||
Write-Host " --help Show this help message"
|
||||
Write-Host ""
|
||||
Write-Host "$esc[33mDisplays:$esc[0m"
|
||||
Write-Host " - System health score (0-100)"
|
||||
|
||||
@@ -4,8 +4,13 @@
|
||||
#Requires -Version 5.1
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Alias('d')]
|
||||
[switch]$DebugMode,
|
||||
|
||||
[Alias('r')]
|
||||
[switch]$Rescan,
|
||||
|
||||
[Alias('h')]
|
||||
[switch]$ShowHelp
|
||||
)
|
||||
|
||||
@@ -37,14 +42,14 @@ $script:CacheTTLHours = 24
|
||||
function Show-UninstallHelp {
|
||||
$esc = [char]27
|
||||
Write-Host ""
|
||||
Write-Host "$esc[1;35mMole Uninstall$esc[0m - Interactive application uninstaller"
|
||||
Write-Host "$esc[1;35mmo uninstall$esc[0m - Interactive application uninstaller"
|
||||
Write-Host ""
|
||||
Write-Host "$esc[33mUsage:$esc[0m mole uninstall [options]"
|
||||
Write-Host "$esc[33mUsage:$esc[0m mo uninstall [options]"
|
||||
Write-Host ""
|
||||
Write-Host "$esc[33mOptions:$esc[0m"
|
||||
Write-Host " -Rescan Force rescan of installed applications"
|
||||
Write-Host " -DebugMode Enable debug logging"
|
||||
Write-Host " -ShowHelp Show this help message"
|
||||
Write-Host " --rescan Force rescan of installed applications"
|
||||
Write-Host " --debug Enable debug logging"
|
||||
Write-Host " --help Show this help message"
|
||||
Write-Host ""
|
||||
Write-Host "$esc[33mFeatures:$esc[0m"
|
||||
Write-Host " - Scans installed programs from registry and Windows Apps"
|
||||
|
||||
@@ -319,6 +319,11 @@ powershell.exe -ExecutionPolicy Bypass -NoLogo -NoProfile -Command "& '%MOLE_DIR
|
||||
$batchPath = Join-Path $InstallDir "mole.cmd"
|
||||
Set-Content -Path $batchPath -Value $batchContent -Encoding ASCII
|
||||
Write-Success "Created launcher: mole.cmd"
|
||||
|
||||
# Also create 'mo' alias
|
||||
$moPath = Join-Path $InstallDir "mo.cmd"
|
||||
Set-Content -Path $moPath -Value $batchContent -Encoding ASCII
|
||||
Write-Success "Created launcher: mo.cmd (short alias)"
|
||||
|
||||
# Add to PATH if requested
|
||||
if ($AddToPath) {
|
||||
@@ -340,7 +345,7 @@ powershell.exe -ExecutionPolicy Bypass -NoLogo -NoProfile -Command "& '%MOLE_DIR
|
||||
Write-Host ""
|
||||
|
||||
if ($AddToPath) {
|
||||
Write-Host " Run 'mole' from any terminal to start"
|
||||
Write-Host " Run 'mo' or 'mole' from any terminal to start"
|
||||
}
|
||||
else {
|
||||
Write-Host " Run the following to start:"
|
||||
|
||||
24
mole.ps1
24
mole.ps1
@@ -10,7 +10,10 @@ param(
|
||||
[Parameter(Position = 1, ValueFromRemainingArguments)]
|
||||
[string[]]$CommandArgs,
|
||||
|
||||
[Alias('v')]
|
||||
[switch]$Version,
|
||||
|
||||
[Alias('h')]
|
||||
[switch]$ShowHelp
|
||||
)
|
||||
|
||||
@@ -71,6 +74,15 @@ function Show-MainHelp {
|
||||
Write-Host ""
|
||||
Write-Host " ${green}EXAMPLES:${nc}"
|
||||
Write-Host ""
|
||||
Write-Host " ${gray}mo${nc} ${gray}# Interactive menu${nc}"
|
||||
Write-Host " ${gray}mo clean${nc} ${gray}# Deep cleanup${nc}"
|
||||
Write-Host " ${gray}mo clean --dry-run${nc} ${gray}# Preview cleanup${nc}"
|
||||
Write-Host " ${gray}mo uninstall${nc} ${gray}# Uninstall apps${nc}"
|
||||
Write-Host " ${gray}mo analyze${nc} ${gray}# Disk analyzer${nc}"
|
||||
Write-Host " ${gray}mo status${nc} ${gray}# System monitor${nc}"
|
||||
Write-Host " ${gray}mo optimize${nc} ${gray}# Optimize system (includes repairs)${nc}"
|
||||
Write-Host " ${gray}mo optimize --dry-run${nc} ${gray}# Preview optimizations${nc}"
|
||||
Write-Host " ${gray}mo purge${nc} ${gray}# Clean dev artifacts${nc}"
|
||||
Write-Host " ${gray}mo${nc} ${gray}# Interactive menu${nc}"
|
||||
Write-Host " ${gray}mo clean${nc} ${gray}# Deep cleanup${nc}"
|
||||
Write-Host " ${gray}mo clean --dry-run${nc} ${gray}# Preview cleanup${nc}"
|
||||
@@ -236,13 +248,13 @@ function Main {
|
||||
$effectiveVersion = $Version
|
||||
$effectiveCommand = $Command
|
||||
|
||||
if ($Command -match '^-(.+)$') {
|
||||
$switchName = $Matches[1]
|
||||
if ($Command -match '^-{1,2}(.+)$') {
|
||||
$switchName = $Matches[1].ToLower()
|
||||
switch ($switchName) {
|
||||
'ShowHelp' { $effectiveShowHelp = $true; $effectiveCommand = $null }
|
||||
'Help' { $effectiveShowHelp = $true; $effectiveCommand = $null }
|
||||
'showhelp' { $effectiveShowHelp = $true; $effectiveCommand = $null }
|
||||
'help' { $effectiveShowHelp = $true; $effectiveCommand = $null }
|
||||
'h' { $effectiveShowHelp = $true; $effectiveCommand = $null }
|
||||
'Version' { $effectiveVersion = $true; $effectiveCommand = $null }
|
||||
'version' { $effectiveVersion = $true; $effectiveCommand = $null }
|
||||
'v' { $effectiveVersion = $true; $effectiveCommand = $null }
|
||||
}
|
||||
}
|
||||
@@ -270,7 +282,7 @@ function Main {
|
||||
Write-MoleError "Unknown command: $effectiveCommand"
|
||||
Write-Host ""
|
||||
Write-Host "Available commands: $($validCommands -join ', ')"
|
||||
Write-Host "Run 'mole -ShowHelp' for more information"
|
||||
Write-Host "Run 'mo --help' for more information"
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user