# 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"}
)