Posh icon indicating copy to clipboard operation
Posh copied to clipboard

Posh.Host.Menu

Open StartAutomating opened this issue 2 years ago • 0 comments
trafficstars

Posh should support N TUI menus of an arbitrary depth.

To make this fairly straightforward, Posh will manage a collection of all menus.

The key in the collection would be the root path, and the value would be a dictionary containing the menu.

This menu structure will take after/supplant the old module MenuShell

For an example:

$Posh.Host.Menu.Add(($posh | Split-Path), @{
    # The key is the name of the menu item
    # underscore indicates a keypress
    "_About Posh" = 
          $Posh # Embedding a value will output that value
    "_Features" = @{  # Hashtables will become nested menus
        "_Fantastic Formatting" = @{
             "Get-Command in Color" = { Get-Command }
             "Get-Member in Color" = { Get-Command | Get-Member }
             "File Colors and Icons"  = { Get-ChildItem Posh: }
         }
    }
    "_News" = { $posh.News.Recent }
    ".Order" = "_About Posh", "_Features", "_News" # "dot" properties are hidden, .Order describes display order
})
  • [ ] #316
  • [ ] #317
  • [ ] #318
  • [ ] #319

StartAutomating avatar Oct 12 '23 06:10 StartAutomating