Skip to content

Extension: Pipe output to command palette in Terminal #8797

@zadjii-msft

Description

@zadjii-msft

Okay, this is gonna sound crazy so bear with me. I was switching git branches, and thought, "I really do not know how to use less well, and git branch | $ grep foo each time is annoying".

Then I thought, we've got this great command palette for filtering a list of things.

As an extension, what if we could pipe a list of items to the terminal, and then have the terminal open up the command palette with those items populated in it. Then selecting one of those items would insert that text?

So something like:

git branch | wt -w 0 select-list --prefix "git checkout "

would pipe to the current window, into the command palette. --prefix "git checkout " would indicate "use this text as a prefix for whatever the selected item was".

So hitting enter on one of these items, like "dev/migrie/foo" would SendInput git checkout dev/migrie/foo to the terminal.

This encapsulates a bunch of things:

  • extensions need to be able to add their own subcommands to the commandline parser
    • they also need to be able to parse their own args
  • extensions need to be able to open a command palette FilterableListView with whatever they want (a set of actions in this case. The actions would all be {sendInput(prefix+item), name=item})

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-CmdPalCommand Palette issues and featuresArea-Commandlinewt.exe's commandline argumentsArea-ExtensibilityA feature that would ideally be fulfilled by us having an extension model.Issue-FeatureComplex enough to require an in depth planning process and actual budgeted, scheduled work.Product-TerminalThe new Windows Terminal.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions