Powershell GUI fronted (WPF) to run categorized console scripts

⌈⌋ ⎇ branch:  ClickyColoury


Artifact [41a4b11c04]

Artifact 41a4b11c04aa1e7e216e005ee0ed391b8f9c01c4:

  • File contrib/OldCliMenu.ps1 — part of check-in [7ca24d3342] at 2018-05-16 18:09:46 on branch trunk — Keep old 3-pane CLI menu (for TextyTypey) as plugin. (user: mario size: 1309)

# encoding: utf-8
# api: clicky
# type: init
# version: 0.1
# title: Old CLI menu
# description: brings back the condensed single-page menu
# category: ui
# state: obsolete
# hidden: 1
# nomenu: 1
#
# The old CLI menu does not provide for category-submenus, but simply
# lists all tools on one page. It lists tools and key combinations in
# a 3-column list.
#

#-- Write out menu list (sorted, 3 columns, with category headers)
function Print-Menu0() {
    param($menu, $cat=".+", $last_cat="", $i=0)
    # group by category
    $ls = Sort-Menu ($menu | ? { $_.title -and $_.key -and ($_.category -match $cat) -and ((!$cfg.hidden) -or !$_.hidden) })
    $ls | % {
        if ($last_cat -ne $_.category) {
            if ($line) { Write-Host ""}
            Write-Host -f Black ("     {0,-74}" -f ($last_cat = $_.category))
            $i = 0
        }
        $line = (($i++) % 3 -ne 2)
        Write-Host -N -f Green ("{0,4}" -f (substr $_.key.split("|")[0] 0 4))
        Write-Host -N -f DarkRed  ("→")
        Write-Host -N:$line -f White ("{0,-21}" -f (substr $_.title 0 21))
    }
    echo ""
}
Set-Alias -Name Print-Menu -Value Print-Menu0 -Scope Global

# clear up category filter
$global:menu_groups = @(
    @{key="m"; category="-never-"; title="Menu"}
)