Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Posh.Host.Menu #315

Open
4 tasks
Tracked by #129
StartAutomating opened this issue Oct 12, 2023 · 0 comments
Open
4 tasks
Tracked by #129

Posh.Host.Menu #315

StartAutomating opened this issue Oct 12, 2023 · 0 comments

Comments

@StartAutomating
Copy link
Owner

StartAutomating commented Oct 12, 2023

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
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant