microsoft / microsoft/terminal

Extension: Pipe output to command palette in Terminal

Open
#8,797 7 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Area-CmdPal Area-Commandline Area-Extensibility Issue-Feature Product-Terminal
Dominant language
C++
Stars
105k
Forks
9.6k
Avg merge
3d 17h
Merged PRs (30d)
29

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the extension command-line parser and the FilterableListView or command-palette entry points mentioned in the issue. Define how an extension would register and parse a subcommand, provide piped items, and send the selected prefixed text to the terminal. Done means the example command can populate the list and send the selected branch command.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
cli, desktop
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.