Provide shell completions for wt #15232

Open
opened 2026-01-31 04:32:08 +00:00 by claunia · 10 comments
Owner

Originally created by @rashil2000 on GitHub (Sep 16, 2021).

Originally assigned to: @kkostrzewa on GitHub.

Description of the new feature/enhancement

Many apps/tools nowadays provide shell completion files (for bash/zsh/powershell). They help in easy discovery of commandline arguments and are overall a QoL enhancement.

Since wt supports a plethora of commandline args, it'be pretty nice to have completion files for PowerShell and CMD (through Clink, if possible).

Proposed technical implementation details (optional)

All shells have their own way of defining completions. (For powershell it's Register-ArgumentCompleter).

Almost all CLI utilities provide the files (examples - ripgrep, gh (CLI), hyperfine). Alacritty, too provides completion files for bash, zsh and fish as a part of their release.

Originally created by @rashil2000 on GitHub (Sep 16, 2021). Originally assigned to: @kkostrzewa on GitHub. <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> # Description of the new feature/enhancement Many apps/tools nowadays provide shell completion files (for bash/zsh/powershell). They help in easy discovery of commandline arguments and are overall a QoL enhancement. Since `wt` supports a plethora of commandline args, it'be pretty nice to have completion files for PowerShell and CMD (through Clink, if possible). # Proposed technical implementation details (optional) All shells have their own way of defining completions. (For powershell it's `Register-ArgumentCompleter`). Almost all CLI utilities provide the files (examples - ripgrep, gh (CLI), hyperfine). Alacritty, too provides [completion files](https://github.com/alacritty/alacritty/releases) for bash, zsh and fish as a part of their release.
claunia added the Issue-FeatureHelp WantedProduct-TerminalArea-Commandline labels 2026-01-31 04:32:09 +00:00
Author
Owner

@zadjii-msft commented on GitHub (Sep 16, 2021):

Sure, I don't see why not.

@zadjii-msft commented on GitHub (Sep 16, 2021): Sure, I don't see why not.
Author
Owner

@WSLUser commented on GitHub (Sep 16, 2021):

I'd personally want to see both powershell and bash completions. Ideally WT commands could be run inside WSL(2) and the shell completion could help with that as well.

@WSLUser commented on GitHub (Sep 16, 2021): I'd personally want to see both powershell and bash completions. Ideally WT commands could be run inside WSL(2) and the shell completion could help with that as well.
Author
Owner

@kkostrzewa commented on GitHub (Apr 2, 2023):

@zadjii-msft if this were scoped to bash and powershell, I'd like to take a stab at it, as I'd like to learn more about creating shell completions. Interested?

@kkostrzewa commented on GitHub (Apr 2, 2023): @zadjii-msft if this were scoped to bash and powershell, I'd like to take a stab at it, as I'd like to learn more about creating shell completions. Interested?
Author
Owner

@zadjii-msft commented on GitHub (Apr 3, 2023):

@kkostrzewa I would love the help! Incremental progress is always better than no progress in my book. I honestly don't know where to even start with these - I've never authored shell completion specs for a shell. But I'd love to learn ☺️

@zadjii-msft commented on GitHub (Apr 3, 2023): @kkostrzewa I would love the help! Incremental progress is always better than no progress in my book. I honestly don't know where to even start with these - I've never authored shell completion specs for a shell. But I'd love to learn ☺️
Author
Owner

@kkostrzewa commented on GitHub (Apr 3, 2023):

@zadjii-msft thx. Feel free to assign this one to me. I'd like to deliver not only an implementation that works for today, but support automated testing, resiliency against new cli args, etc. Not sure yet how to do that.

@kkostrzewa commented on GitHub (Apr 3, 2023): @zadjii-msft thx. Feel free to assign this one to me. I'd like to deliver not only an implementation that works for today, but support automated testing, resiliency against new cli args, etc. Not sure yet how to do that.
Author
Owner

@zadjii-msft commented on GitHub (Apr 3, 2023):

That would certainly be impressive - but I'll also be more than happy if we just start with the specs in the first PR, then follow up with additional validation. Our unit testing story, especially in that part of the codebase, is a little tricky so I wouldn't want you to overindex on that 😛

@zadjii-msft commented on GitHub (Apr 3, 2023): That would certainly be impressive - but I'll also be more than happy if we just start with the specs in the first PR, then follow up with additional validation. Our unit testing story, especially in that part of the codebase, is a little tricky so I wouldn't want you to overindex on that 😛
Author
Owner

@douglaswth commented on GitHub (Apr 3, 2023):

One thing that I've found nice in a lot of modern command line utilities is a pattern where the command itself or a helper command implements the Bash complete -C interface (looks at some environment variables and outputs the completions I think) as this can be consumed by several shells very easily and even the PowerShell completion script block is fairly boilerplate as well.

You can take a look at AWS CLI Command Line Completion for an example of how this is set up on the consumer side.

@douglaswth commented on GitHub (Apr 3, 2023): One thing that I've found nice in a lot of modern command line utilities is a pattern where the command itself or a helper command implements the Bash `complete -C` interface (looks at some environment variables and outputs the completions I think) as this can be consumed by several shells very easily and even the PowerShell completion script block is fairly boilerplate as well. You can take a look at [AWS CLI Command Line Completion](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-completion.html) for an example of how this is set up on the consumer side.
Author
Owner

@kkostrzewa commented on GitHub (May 17, 2023):

See if the pattern done by dotnet.exe will work - https://learn.microsoft.com/en-us/dotnet/core/tools/enable-tab-autocomplete. Would require wt.exe --complete (assuming that flag) would write to stdout

Similar pattern for bash? Maybe wt.exe --complete powershell or wt.exe --complete bash

@kkostrzewa commented on GitHub (May 17, 2023): See if the pattern done by dotnet.exe will work - https://learn.microsoft.com/en-us/dotnet/core/tools/enable-tab-autocomplete. Would require `wt.exe --complete` (assuming that flag) would write to stdout Similar pattern for bash? Maybe `wt.exe --complete powershell` or `wt.exe --complete bash`
Author
Owner

@zadjii-msft commented on GitHub (May 17, 2023):

That might be Hard - wt.exe is a WINDOWS subsystem exe, not a CONSOLE one, and there's been historically bad experience trying to mix and match those paradigms.

That being said, there's been talk in the past about doing a wtc.exe or something that's a CONSOLE exe for interacting with the Terminal.

@zadjii-msft commented on GitHub (May 17, 2023): That might be **H**ard - `wt.exe` is a WINDOWS subsystem exe, not a CONSOLE one, and there's been historically bad experience trying to mix and match those paradigms. That being said, there's been talk in the past about doing a `wtc.exe` or something that's a CONSOLE exe for interacting with the Terminal.
Author
Owner

@kkostrzewa commented on GitHub (May 17, 2023):

Yeah, I thought that might be a problem. It may be possible to AttachConsole / AllocConsole when the flag is set so stdout is a valid handle. I'll poc this first, of course, as I've never done anything like this for realz.

@kkostrzewa commented on GitHub (May 17, 2023): Yeah, I thought that might be a problem. It may be possible to AttachConsole / AllocConsole when the flag is set so stdout is a valid handle. I'll poc this first, of course, as I've never done anything like this for realz.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#15232