-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bb0e564
commit 7842396
Showing
2 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
function Invoke-DrawMenu { | ||
## supportfunction to the Menu function below | ||
param ( | ||
$menuItems, | ||
$menuPosition, | ||
$menuTitel | ||
) | ||
$fcolor = $host.UI.RawUI.ForegroundColor | ||
$bcolor = $host.UI.RawUI.BackgroundColor | ||
$l = $menuItems.length + 1 | ||
Clear-Host | ||
$menuwidth = $menuTitel.length + 4 | ||
Write-Host "`t" -NoNewline | ||
Write-Host ('*' * $menuwidth) -fore $fcolor -back $bcolor | ||
Write-Host "`t" -NoNewline | ||
Write-Host "* $menuTitel *" -fore $fcolor -back $bcolor | ||
Write-Host "`t" -NoNewline | ||
Write-Host ('*' * $menuwidth) -fore $fcolor -back $bcolor | ||
Write-Host '' | ||
Write-Debug "L: $l MenuItems: $menuItems MenuPosition: $menuposition" | ||
for ($i = 0; $i -le $l; $i++) { | ||
Write-Host "`t" -NoNewline | ||
if ($i -eq $menuPosition) { | ||
Write-Host "$($menuItems[$i])" -fore $bcolor -back $fcolor | ||
} else { | ||
Write-Host "$($menuItems[$i])" -fore $fcolor -back $bcolor | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
function Menu { | ||
## Generate a small "DOS-like" menu. | ||
## Choose a menuitem using up and down arrows, select by pressing ENTER | ||
param ( | ||
[array]$menuItems, | ||
$menuTitel = 'MENU' | ||
) | ||
$vkeycode = 0 | ||
$pos = 0 | ||
Invoke-DrawMenu $menuItems $pos $menuTitel | ||
while ($vkeycode -ne 13) { | ||
$press = $host.ui.rawui.readkey('NoEcho,IncludeKeyDown') | ||
$vkeycode = $press.virtualkeycode | ||
Write-Host "$($press.character)" -NoNewline | ||
if ($vkeycode -eq 38) { $pos-- } | ||
if ($vkeycode -eq 40) { $pos++ } | ||
if ($pos -lt 0) { $pos = 0 } | ||
if ($pos -ge $menuItems.length) { $pos = $menuItems.length - 1 } | ||
Invoke-DrawMenu $menuItems $pos $menuTitel | ||
} | ||
Write-Output $($menuItems[$pos]) | ||
} | ||
|
||
|
||
<# | ||
? What account do you want to log into? [Use arrows to move, type to filter] | ||
> GitHub.com | ||
GitHub Enterprise Server | ||
#> |