feat(ui): detect missing fzf and show installation hints
This commit is contained in:
@@ -38,6 +38,10 @@ pwsh ./Scripts/Start-IntuneToolkit.ps1 -TenantId "<tenant-id>"
|
||||
* `pwsh` 7+
|
||||
* Microsoft Graph app registration
|
||||
* App-only auth with client secret or certificate, or browser auth with a public client redirect URI
|
||||
* `fzf` (optional) — for the best interactive menu experience in `Start-IntuneToolkit.ps1` and `Start-IntuneManagementTui.ps1`. Falls back to numbered menus if not installed.
|
||||
* macOS: `brew install fzf`
|
||||
* Linux: `sudo apt install fzf` (or `dnf` / `pacman`)
|
||||
* Windows: `winget install junegunn.fzf` (or `choco install fzf`)
|
||||
|
||||
## Default object types
|
||||
|
||||
|
||||
@@ -18,6 +18,26 @@ function Test-FzfAvailable
|
||||
return [bool](Get-Command fzf -ErrorAction SilentlyContinue)
|
||||
}
|
||||
|
||||
function Show-FzfHint
|
||||
{
|
||||
if(Test-FzfAvailable) { return }
|
||||
Write-Host "[fzf not found]" -ForegroundColor Yellow -NoNewline
|
||||
Write-Host " Install fzf for the best interactive menu experience. Falling back to numbered menus." -ForegroundColor DarkGray
|
||||
if($IsMacOS)
|
||||
{
|
||||
Write-Host " Install: brew install fzf" -ForegroundColor DarkGray
|
||||
}
|
||||
elseif($IsLinux)
|
||||
{
|
||||
Write-Host " Install: sudo apt install fzf (or dnf/pacman)" -ForegroundColor DarkGray
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Host " Install: winget install junegunn.fzf (or choco install fzf)" -ForegroundColor DarkGray
|
||||
}
|
||||
Write-Host ""
|
||||
}
|
||||
|
||||
function Show-FzfMenu
|
||||
{
|
||||
param(
|
||||
@@ -126,6 +146,8 @@ if(Test-Path $settingsPath)
|
||||
}
|
||||
#endregion
|
||||
|
||||
Show-FzfHint
|
||||
|
||||
while($true)
|
||||
{
|
||||
Clear-Host
|
||||
|
||||
@@ -35,6 +35,29 @@ function Test-FzfAvailable
|
||||
return [bool](Get-Command fzf -ErrorAction SilentlyContinue)
|
||||
}
|
||||
|
||||
function Show-FzfHint
|
||||
{
|
||||
if(Test-FzfAvailable) { return }
|
||||
Write-Host "`n[fzf not found]" -ForegroundColor Yellow -NoNewline
|
||||
Write-Host " Install fzf for the best interactive menu experience.`n" -ForegroundColor DarkGray
|
||||
if($IsMacOS)
|
||||
{
|
||||
Write-Host " macOS: brew install fzf" -ForegroundColor DarkGray
|
||||
}
|
||||
elseif($IsLinux)
|
||||
{
|
||||
Write-Host " Debian/Ubuntu: sudo apt install fzf" -ForegroundColor DarkGray
|
||||
Write-Host " Fedora: sudo dnf install fzf" -ForegroundColor DarkGray
|
||||
Write-Host " Arch: sudo pacman -S fzf" -ForegroundColor DarkGray
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Host " Windows: winget install junegunn.fzf" -ForegroundColor DarkGray
|
||||
Write-Host " choco install fzf" -ForegroundColor DarkGray
|
||||
}
|
||||
Write-Host " (Falling back to numbered menus for now.)`n" -ForegroundColor DarkGray
|
||||
}
|
||||
|
||||
function Show-FzfMenu
|
||||
{
|
||||
param(
|
||||
@@ -263,6 +286,8 @@ if(-not $currentTenant -or -not $currentTenant.TenantName)
|
||||
}
|
||||
#endregion
|
||||
|
||||
Show-FzfHint
|
||||
|
||||
# Build common parameter hashtable
|
||||
$commonParams = @{
|
||||
TenantId = $TenantId
|
||||
|
||||
Reference in New Issue
Block a user