feat(tui): add create-new-folder option to folder browser
Select-FolderPath gets a [Create new folder] entry. It prompts for a name, validates it, creates the folder inside the current one and navigates into it.
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
# macOS Intune Toolkit Changelog
|
||||
|
||||
## 2026-11-24 — v4.4.3 — Create new folder in folder browser
|
||||
|
||||
### Added
|
||||
- **`Scripts/Private/Start-IntuneManagementTui.ps1`**
|
||||
- `Select-FolderPath` has a new **[Create new folder]** entry. It asks for a name, creates the folder inside the current one and moves into it. Invalid names and creation errors are reported without leaving the browser.
|
||||
|
||||
## 2026-11-24 — v4.4.2 — Export built-in Intune roles, fix ASCII header failure
|
||||
|
||||
### Fixed
|
||||
|
||||
@@ -123,7 +123,7 @@ function Select-FolderPath
|
||||
|
||||
while($true)
|
||||
{
|
||||
$entries = @("[Use this folder]", "[Type path manually]")
|
||||
$entries = @("[Use this folder]", "[Create new folder]", "[Type path manually]")
|
||||
$parent = Split-Path -Path $current -Parent
|
||||
if($parent) { $entries += ".." }
|
||||
$subdirs = Get-ChildItem -LiteralPath $current -Directory -ErrorAction SilentlyContinue | Sort-Object Name | ForEach-Object { "$($_.Name)/" }
|
||||
@@ -135,6 +135,15 @@ function Select-FolderPath
|
||||
switch ($choice)
|
||||
{
|
||||
"[Use this folder]" { return $current }
|
||||
"[Create new folder]" {
|
||||
$name = (Read-Host "New folder name (inside $current)").Trim()
|
||||
if([string]::IsNullOrWhiteSpace($name)) { continue }
|
||||
if($name.IndexOfAny([IO.Path]::GetInvalidFileNameChars()) -ge 0) { Write-Host "Invalid folder name." -ForegroundColor Yellow; continue }
|
||||
$newPath = Join-Path $current $name
|
||||
try { New-Item -ItemType Directory -Path $newPath -Force -ErrorAction Stop | Out-Null; $current = $newPath }
|
||||
catch { Write-Host "Could not create folder: $($_.Exception.Message)" -ForegroundColor Yellow }
|
||||
continue
|
||||
}
|
||||
"[Type path manually]" { $typed = Read-Host "Enter path"; if(-not [string]::IsNullOrWhiteSpace($typed)) { return $typed }; continue }
|
||||
".." { $current = $parent; continue }
|
||||
default { $current = Join-Path $current ($choice.TrimEnd('/')); continue }
|
||||
|
||||
Reference in New Issue
Block a user