mirror of
https://github.com/tw93/Mole.git
synced 2026-02-16 12:56:11 +00:00
Merge branch 'windows' into windows
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@@ -14,3 +14,8 @@ bin/*.exe
|
|||||||
# Test artifacts
|
# Test artifacts
|
||||||
*.test
|
*.test
|
||||||
coverage.out
|
coverage.out
|
||||||
|
|
||||||
|
# Main branch specific files
|
||||||
|
ANTIGRAVITY.md
|
||||||
|
CLAUDE.md
|
||||||
|
windows-readme-update.md
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 309 KiB After Width: | Height: | Size: 325 KiB |
76
README.md
76
README.md
@@ -1,4 +1,5 @@
|
|||||||
<div align="center">
|
<div align="center">
|
||||||
|
<img src="https://cdn.tw93.fun/pic/cole.png" alt="Mole Logo" width="120" height="120" style="border-radius:50%" />
|
||||||
<h1>Mole</h1>
|
<h1>Mole</h1>
|
||||||
<p><em>Deep clean and optimize your Windows.</em></p>
|
<p><em>Deep clean and optimize your Windows.</em></p>
|
||||||
</div>
|
</div>
|
||||||
@@ -12,9 +13,8 @@
|
|||||||
<a href="https://t.me/+GclQS9ZnxyI2ODQ1"><img src="https://img.shields.io/badge/chat-Telegram-blueviolet?style=flat-square&logo=Telegram" alt="Telegram"></a>
|
<a href="https://t.me/+GclQS9ZnxyI2ODQ1"><img src="https://img.shields.io/badge/chat-Telegram-blueviolet?style=flat-square&logo=Telegram" alt="Telegram"></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
> [!WARNING]
|
||||||
<img src="https://cdn.tw93.fun/img/mole.jpeg" alt="Mole - 95.50GB freed" width="1000" />
|
> **Experimental Status**: The Windows version is currently **not mature**. If your computer is critical or contains important data, **please do not use this tool**.
|
||||||
</p>
|
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
@@ -36,26 +36,33 @@ Mole is designed for Windows 10/11. This is the native Windows version ported fr
|
|||||||
|
|
||||||
## Quick Start
|
## Quick Start
|
||||||
|
|
||||||
Install via PowerShell:
|
### Quick Install (One-Liner)
|
||||||
|
|
||||||
|
**Recommended:** Run this single command in PowerShell:
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
# Download and run installer (recommended)
|
iwr -useb https://raw.githubusercontent.com/tw93/Mole/windows/quick-install.ps1 | iex
|
||||||
iwr -Uri "https://raw.githubusercontent.com/tw93/mole/windows/install.ps1" -OutFile "$env:TEMP\mole-install.ps1"; & "$env:TEMP\mole-install.ps1" -AddToPath
|
|
||||||
|
|
||||||
# Or install with specific options
|
|
||||||
# -Branch windows for latest code, -Tag v1.17.0 for specific version
|
|
||||||
iwr -Uri "https://raw.githubusercontent.com/tw93/mole/windows/install.ps1" -OutFile "$env:TEMP\mole-install.ps1"; & "$env:TEMP\mole-install.ps1" -AddToPath -CreateShortcut
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Or install manually:
|
This will automatically download and install Mole with PATH configuration.
|
||||||
|
|
||||||
|
### Manual Installation
|
||||||
|
|
||||||
|
If you prefer to review the code first or customize the installation:
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
# Clone the repository and checkout windows branch
|
# Clone the repository
|
||||||
git clone -b windows https://github.com/tw93/Mole.git
|
git clone https://github.com/tw93/Mole.git
|
||||||
cd Mole
|
cd Mole
|
||||||
|
|
||||||
|
# Switch to windows branch
|
||||||
|
git checkout windows
|
||||||
|
|
||||||
# Run the installer
|
# Run the installer
|
||||||
.\install.ps1 -AddToPath
|
.\install.ps1 -AddToPath
|
||||||
|
|
||||||
|
# Optional: Create Start Menu shortcut
|
||||||
|
.\install.ps1 -AddToPath -CreateShortcut
|
||||||
```
|
```
|
||||||
|
|
||||||
Run:
|
Run:
|
||||||
@@ -153,6 +160,7 @@ System: 12/32 GB RAM | 280/460 GB Disk (61%) | Uptime 6d
|
|||||||
✓ Refresh Windows Search index
|
✓ Refresh Windows Search index
|
||||||
✓ Clear thumbnail cache
|
✓ Clear thumbnail cache
|
||||||
✓ Optimize startup programs
|
✓ Optimize startup programs
|
||||||
|
✓ System repairs (Font/Icon/Store/Search)
|
||||||
|
|
||||||
====================================================================
|
====================================================================
|
||||||
System optimization completed
|
System optimization completed
|
||||||
@@ -242,6 +250,9 @@ Custom scan paths can be configured with `mo purge --paths`.
|
|||||||
|
|
||||||
# Create Start Menu shortcut
|
# Create Start Menu shortcut
|
||||||
.\install.ps1 -AddToPath -CreateShortcut
|
.\install.ps1 -AddToPath -CreateShortcut
|
||||||
|
|
||||||
|
# Optional: Custom install location
|
||||||
|
.\install.ps1 -InstallDir C:\Tools\Mole -AddToPath
|
||||||
```
|
```
|
||||||
|
|
||||||
### Uninstall
|
### Uninstall
|
||||||
@@ -269,12 +280,12 @@ mole/ (windows branch)
|
|||||||
├── go.mod # Go module definition
|
├── go.mod # Go module definition
|
||||||
├── go.sum # Go dependencies
|
├── go.sum # Go dependencies
|
||||||
├── bin/
|
├── bin/
|
||||||
│ ├── clean.ps1 # Deep cleanup orchestrator
|
301: │ ├── clean.ps1 # Deep cleanup orchestrator
|
||||||
│ ├── uninstall.ps1 # Interactive app uninstaller
|
302: │ ├── uninstall.ps1 # Interactive app uninstaller
|
||||||
│ ├── optimize.ps1 # System optimization
|
303: │ ├── optimize.ps1 # System optimization
|
||||||
│ ├── purge.ps1 # Project artifact cleanup
|
304: │ ├── purge.ps1 # Project artifact cleanup
|
||||||
│ ├── analyze.ps1 # Disk analyzer wrapper
|
305: │ ├── analyze.ps1 # Disk analyzer wrapper
|
||||||
│ └── status.ps1 # Status monitor wrapper
|
306: │ └── status.ps1 # Status monitor wrapper
|
||||||
├── cmd/
|
├── cmd/
|
||||||
│ ├── analyze/ # Disk analyzer (Go TUI)
|
│ ├── analyze/ # Disk analyzer (Go TUI)
|
||||||
│ │ └── main.go
|
│ │ └── main.go
|
||||||
@@ -320,6 +331,33 @@ go build -o bin/status.exe ./cmd/status/
|
|||||||
|
|
||||||
## Community Love
|
## Community Love
|
||||||
|
|
||||||
|
### Phase 1: Core Infrastructure ✅
|
||||||
|
|
||||||
|
- [x] `install.ps1` - Windows installer
|
||||||
|
- [x] `mole.ps1` - Main CLI entry point
|
||||||
|
- [x] `lib/core/*` - Core utility libraries
|
||||||
|
|
||||||
|
### Phase 2: Cleanup Features ✅
|
||||||
|
|
||||||
|
- [x] `bin/clean.ps1` - Deep cleanup orchestrator
|
||||||
|
- [x] `bin/uninstall.ps1` - App removal with leftover detection
|
||||||
|
- [x] `bin/optimize.ps1` - System optimization
|
||||||
|
- [x] `bin/purge.ps1` - Project artifact cleanup
|
||||||
|
- [x] `lib/clean/*` - Cleanup modules
|
||||||
|
|
||||||
|
### Phase 3: TUI Tools ✅
|
||||||
|
|
||||||
|
- [x] `cmd/analyze/` - Disk usage analyzer (Go)
|
||||||
|
- [x] `cmd/status/` - Real-time system monitor (Go)
|
||||||
|
- [x] `bin/analyze.ps1` - Analyzer wrapper
|
||||||
|
- [x] `bin/status.ps1` - Status wrapper
|
||||||
|
|
||||||
|
### Phase 4: Testing & CI (Planned)
|
||||||
|
|
||||||
|
- [ ] `tests/` - Pester tests
|
||||||
|
- [ ] GitHub Actions workflows
|
||||||
|
- [ ] `scripts/build.ps1` - Build automation
|
||||||
|
|
||||||
Mole wouldn't be possible without these amazing contributors. They've built countless features that make Mole what it is today. Go follow them! ❤️
|
Mole wouldn't be possible without these amazing contributors. They've built countless features that make Mole what it is today. Go follow them! ❤️
|
||||||
|
|
||||||
[](https://github.com/tw93/Mole/graphs/contributors)
|
[](https://github.com/tw93/Mole/graphs/contributors)
|
||||||
|
|||||||
@@ -20,6 +20,20 @@ param(
|
|||||||
[switch]$Whitelist,
|
[switch]$Whitelist,
|
||||||
|
|
||||||
[Alias('h')]
|
[Alias('h')]
|
||||||
|
|
||||||
|
[Alias('system')]
|
||||||
|
[switch]$System,
|
||||||
|
|
||||||
|
[Alias('game-media')]
|
||||||
|
[switch]$GameMedia,
|
||||||
|
|
||||||
|
[Alias('debug')]
|
||||||
|
[switch]$DebugMode,
|
||||||
|
|
||||||
|
[Alias('whitelist')]
|
||||||
|
[switch]$Whitelist,
|
||||||
|
|
||||||
|
[Alias('help')]
|
||||||
[switch]$ShowHelp
|
[switch]$ShowHelp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,11 @@ param(
|
|||||||
[switch]$DebugMode,
|
[switch]$DebugMode,
|
||||||
|
|
||||||
[Alias('h')]
|
[Alias('h')]
|
||||||
|
|
||||||
|
[Alias('debug')]
|
||||||
|
[switch]$DebugMode,
|
||||||
|
|
||||||
|
[Alias('help')]
|
||||||
[switch]$ShowHelp
|
[switch]$ShowHelp
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -52,16 +57,15 @@ function Show-OptimizeHelp {
|
|||||||
Write-Host " --help Show this help message"
|
Write-Host " --help Show this help message"
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
Write-Host "$esc[33mWhat it does:$esc[0m"
|
Write-Host "$esc[33mWhat it does:$esc[0m"
|
||||||
Write-Host " - Disk optimization (TRIM for SSD, defrag for HDD)"
|
Write-Host " - Disk optimization (TRIM/Defrag)"
|
||||||
Write-Host " - DNS cache flush"
|
Write-Host " - Windows Search & Update check"
|
||||||
Write-Host " - Network stack optimization"
|
Write-Host " - Network & DNS optimization"
|
||||||
Write-Host " - Font cache rebuild"
|
Write-Host " - System cache cleanup & repairs"
|
||||||
Write-Host " - Icon cache rebuild"
|
Write-Host " (Font cache, Icon cache, Store cache)"
|
||||||
Write-Host " - Windows Search optimization"
|
Write-Host ""
|
||||||
Write-Host " - Windows Store cache reset"
|
Write-Host "$esc[33mExamples:$esc[0m"
|
||||||
Write-Host " - Startup program analysis"
|
Write-Host " mo optimize # Run all optimizations"
|
||||||
Write-Host " - Disk health check"
|
Write-Host " mo optimize --dry-run # Preview what would happen"
|
||||||
Write-Host " - Windows Update status"
|
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
Write-Host "$esc[33mExamples:$esc[0m"
|
Write-Host "$esc[33mExamples:$esc[0m"
|
||||||
Write-Host " mo optimize # Run all optimizations"
|
Write-Host " mo optimize # Run all optimizations"
|
||||||
@@ -706,6 +710,10 @@ function Show-OptimizeSummary {
|
|||||||
else {
|
else {
|
||||||
Write-Host " Optimizations applied: $esc[32m$($script:OptimizationsApplied)$esc[0m"
|
Write-Host " Optimizations applied: $esc[32m$($script:OptimizationsApplied)$esc[0m"
|
||||||
|
|
||||||
|
if ($script:RepairsApplied -gt 0) {
|
||||||
|
Write-Host " Repairs applied: $esc[32m$($script:RepairsApplied)$esc[0m"
|
||||||
|
}
|
||||||
|
|
||||||
if ($script:IssuesFixed -gt 0) {
|
if ($script:IssuesFixed -gt 0) {
|
||||||
Write-Host " Issues fixed: $esc[32m$($script:IssuesFixed)$esc[0m"
|
Write-Host " Issues fixed: $esc[32m$($script:IssuesFixed)$esc[0m"
|
||||||
}
|
}
|
||||||
@@ -763,17 +771,29 @@ function Main {
|
|||||||
Clear-DnsCache
|
Clear-DnsCache
|
||||||
Optimize-Network
|
Optimize-Network
|
||||||
|
|
||||||
# Run cache rebuilds (repairs integrated into optimize)
|
|
||||||
Repair-FontCache
|
|
||||||
Repair-IconCache
|
|
||||||
Optimize-SearchIndex
|
|
||||||
Repair-StoreCache
|
|
||||||
|
|
||||||
# Run health checks
|
# Run health checks
|
||||||
Get-StartupPrograms
|
Get-StartupPrograms
|
||||||
Test-DiskHealth
|
Test-DiskHealth
|
||||||
Test-WindowsUpdate
|
Test-WindowsUpdate
|
||||||
|
|
||||||
|
# Run repairs (consolidated)
|
||||||
|
Write-Host ""
|
||||||
|
Write-Host "$esc[34m$($script:Icons.Arrow) System Repairs$esc[0m"
|
||||||
|
|
||||||
|
Repair-FontCache
|
||||||
|
Repair-StoreCache
|
||||||
|
Repair-SearchIndex
|
||||||
|
Repair-IconCache
|
||||||
|
|
||||||
|
# System file check is slow, ask first
|
||||||
|
if (-not $script:DryRun -and (Test-IsAdmin)) {
|
||||||
|
Write-Host ""
|
||||||
|
$runSfc = Read-Host "Run System File Checker? This may take several minutes (y/N)"
|
||||||
|
if ($runSfc -eq 'y' -or $runSfc -eq 'Y') {
|
||||||
|
Test-SystemFiles
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# Summary
|
# Summary
|
||||||
Show-OptimizeSummary
|
Show-OptimizeSummary
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,13 @@ param(
|
|||||||
[switch]$Paths,
|
[switch]$Paths,
|
||||||
|
|
||||||
[Alias('h')]
|
[Alias('h')]
|
||||||
|
[Alias('debug')]
|
||||||
|
[switch]$DebugMode,
|
||||||
|
|
||||||
|
[Alias('paths')]
|
||||||
|
[switch]$Paths,
|
||||||
|
|
||||||
|
[Alias('help')]
|
||||||
[switch]$ShowHelp
|
[switch]$ShowHelp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
36
mole.ps1
36
mole.ps1
@@ -60,12 +60,12 @@ function Show-MainHelp {
|
|||||||
Write-Host ""
|
Write-Host ""
|
||||||
Write-Host " ${green}COMMANDS:${nc}"
|
Write-Host " ${green}COMMANDS:${nc}"
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
Write-Host " ${cyan}clean${nc} Deep system cleanup (caches, temp, logs)"
|
Write-Host " ${cyan}clean${nc} Deep system cleanup"
|
||||||
Write-Host " ${cyan}uninstall${nc} Smart application uninstaller"
|
Write-Host " ${cyan}uninstall${nc} Smart application uninstaller"
|
||||||
Write-Host " ${cyan}analyze${nc} Visual disk space analyzer"
|
|
||||||
Write-Host " ${cyan}status${nc} Real-time system monitor"
|
|
||||||
Write-Host " ${cyan}optimize${nc} System optimization and repairs"
|
Write-Host " ${cyan}optimize${nc} System optimization and repairs"
|
||||||
Write-Host " ${cyan}purge${nc} Clean project build artifacts"
|
Write-Host " ${cyan}analyze${nc} Disk space analyzer"
|
||||||
|
Write-Host " ${cyan}status${nc} System monitor"
|
||||||
|
Write-Host " ${cyan}purge${nc} Clean project artifacts"
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
Write-Host " ${green}OPTIONS:${nc}"
|
Write-Host " ${green}OPTIONS:${nc}"
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
@@ -83,6 +83,12 @@ function Show-MainHelp {
|
|||||||
Write-Host " ${gray}mo optimize${nc} ${gray}# Optimize system (includes repairs)${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 optimize --dry-run${nc} ${gray}# Preview optimizations${nc}"
|
||||||
Write-Host " ${gray}mo purge${nc} ${gray}# Clean dev artifacts${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}"
|
||||||
|
Write-Host " ${gray}mo optimize${nc} ${gray}# Optimize system${nc}"
|
||||||
|
Write-Host " ${gray}mo optimize --dry-run${nc} ${gray}# Preview optimization${nc}"
|
||||||
|
Write-Host " ${gray}mo uninstall${nc} ${gray}# Uninstall apps${nc}"
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
Write-Host " ${green}ENVIRONMENT:${nc}"
|
Write-Host " ${green}ENVIRONMENT:${nc}"
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
@@ -105,6 +111,12 @@ function Show-MainMenu {
|
|||||||
Command = "clean"
|
Command = "clean"
|
||||||
Icon = $script:Icons.Trash
|
Icon = $script:Icons.Trash
|
||||||
}
|
}
|
||||||
|
@{
|
||||||
|
Name = "Optimize"
|
||||||
|
Description = "Optimization & repairs"
|
||||||
|
Command = "optimize"
|
||||||
|
Icon = $script:Icons.Arrow
|
||||||
|
}
|
||||||
@{
|
@{
|
||||||
Name = "Uninstall"
|
Name = "Uninstall"
|
||||||
Description = "Remove applications"
|
Description = "Remove applications"
|
||||||
@@ -123,12 +135,6 @@ function Show-MainMenu {
|
|||||||
Command = "status"
|
Command = "status"
|
||||||
Icon = $script:Icons.Solid
|
Icon = $script:Icons.Solid
|
||||||
}
|
}
|
||||||
@{
|
|
||||||
Name = "Optimize"
|
|
||||||
Description = "Optimization & repairs"
|
|
||||||
Command = "optimize"
|
|
||||||
Icon = $script:Icons.Arrow
|
|
||||||
}
|
|
||||||
@{
|
@{
|
||||||
Name = "Purge"
|
Name = "Purge"
|
||||||
Description = "Clean dev artifacts"
|
Description = "Clean dev artifacts"
|
||||||
@@ -161,7 +167,7 @@ function Invoke-MoleCommand {
|
|||||||
if (-not (Test-Path $scriptPath)) {
|
if (-not (Test-Path $scriptPath)) {
|
||||||
Write-MoleError "Unknown command: $CommandName"
|
Write-MoleError "Unknown command: $CommandName"
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
Write-Host "Run 'mole -ShowHelp' for available commands"
|
Write-Host "Run 'mo --help' for available commands"
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,13 +183,13 @@ function Invoke-MoleCommand {
|
|||||||
# Remove surrounding quotes if present
|
# Remove surrounding quotes if present
|
||||||
$cleanArg = $arg.Trim("'`"")
|
$cleanArg = $arg.Trim("'`"")
|
||||||
|
|
||||||
if ($cleanArg -match '^-(\w+)$') {
|
if ($cleanArg -match '^-{1,2}([\w-]+)$') {
|
||||||
# It's a switch parameter (e.g., -DryRun)
|
# It's a switch parameter (e.g., -DryRun or --dry-run)
|
||||||
$paramName = $Matches[1]
|
$paramName = $Matches[1]
|
||||||
$splatParams[$paramName] = $true
|
$splatParams[$paramName] = $true
|
||||||
}
|
}
|
||||||
elseif ($cleanArg -match '^-(\w+)[=:](.+)$') {
|
elseif ($cleanArg -match '^-{1,2}([\w-]+)[=:](.+)$') {
|
||||||
# It's a named parameter with value (e.g., -Name=Value or -Name:Value)
|
# It's a named parameter with value (e.g., --name=value)
|
||||||
$paramName = $Matches[1]
|
$paramName = $Matches[1]
|
||||||
$paramValue = $Matches[2].Trim("'`"")
|
$paramValue = $Matches[2].Trim("'`"")
|
||||||
$splatParams[$paramName] = $paramValue
|
$splatParams[$paramName] = $paramValue
|
||||||
|
|||||||
87
quick-install.ps1
Normal file
87
quick-install.ps1
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
#!/usr/bin/env pwsh
|
||||||
|
# Mole Quick Installer for Windows
|
||||||
|
# One-liner install: iwr -useb https://raw.githubusercontent.com/tw93/Mole/windows/quick-install.ps1 | iex
|
||||||
|
|
||||||
|
#Requires -Version 5.1
|
||||||
|
|
||||||
|
$ErrorActionPreference = "Stop"
|
||||||
|
Set-StrictMode -Version Latest
|
||||||
|
|
||||||
|
# Colors
|
||||||
|
$ESC = [char]27
|
||||||
|
$Colors = @{
|
||||||
|
Green = "$ESC[32m"
|
||||||
|
Yellow = "$ESC[33m"
|
||||||
|
Cyan = "$ESC[36m"
|
||||||
|
Red = "$ESC[31m"
|
||||||
|
NC = "$ESC[0m"
|
||||||
|
}
|
||||||
|
|
||||||
|
function Write-Step {
|
||||||
|
param([string]$Message)
|
||||||
|
Write-Host " $($Colors.Cyan)→$($Colors.NC) $Message"
|
||||||
|
}
|
||||||
|
|
||||||
|
function Write-Success {
|
||||||
|
param([string]$Message)
|
||||||
|
Write-Host " $($Colors.Green)✓$($Colors.NC) $Message"
|
||||||
|
}
|
||||||
|
|
||||||
|
function Write-ErrorMsg {
|
||||||
|
param([string]$Message)
|
||||||
|
Write-Host " $($Colors.Red)✗$($Colors.NC) $Message"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Main installation
|
||||||
|
try {
|
||||||
|
Write-Host ""
|
||||||
|
Write-Host " $($Colors.Cyan)Mole Quick Installer$($Colors.NC)"
|
||||||
|
Write-Host " $($Colors.Yellow)Installing experimental Windows version...$($Colors.NC)"
|
||||||
|
Write-Host ""
|
||||||
|
|
||||||
|
# Check prerequisites
|
||||||
|
Write-Step "Checking prerequisites..."
|
||||||
|
|
||||||
|
if (-not (Get-Command git -ErrorAction SilentlyContinue)) {
|
||||||
|
Write-ErrorMsg "Git is not installed. Please install Git first:"
|
||||||
|
Write-Host " https://git-scm.com/download/win"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Success "Git found"
|
||||||
|
|
||||||
|
# Create temp directory
|
||||||
|
$TempDir = Join-Path $env:TEMP "mole-install-$(Get-Random)"
|
||||||
|
Write-Step "Downloading Mole..."
|
||||||
|
|
||||||
|
# Clone windows branch
|
||||||
|
git clone --quiet --depth 1 --branch windows https://github.com/tw93/Mole.git $TempDir 2>&1 | Out-Null
|
||||||
|
|
||||||
|
if (-not (Test-Path "$TempDir\install.ps1")) {
|
||||||
|
Write-ErrorMsg "Failed to download installer"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Success "Downloaded to temp directory"
|
||||||
|
|
||||||
|
# Run installer
|
||||||
|
Write-Step "Running installer..."
|
||||||
|
Write-Host ""
|
||||||
|
|
||||||
|
& "$TempDir\install.ps1" -AddToPath
|
||||||
|
|
||||||
|
Write-Host ""
|
||||||
|
Write-Success "Installation complete!"
|
||||||
|
Write-Host ""
|
||||||
|
Write-Host " Run ${Colors.Green}mole$($Colors.NC) to get started"
|
||||||
|
Write-Host ""
|
||||||
|
|
||||||
|
} catch {
|
||||||
|
Write-ErrorMsg "Installation failed: $_"
|
||||||
|
exit 1
|
||||||
|
} finally {
|
||||||
|
# Cleanup
|
||||||
|
if (Test-Path $TempDir) {
|
||||||
|
Remove-Item $TempDir -Recurse -Force -ErrorAction SilentlyContinue
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user