DEV Community

Cover image for PS7-Completion: Tab completion for Git, SSH and WinGet in PowerShell
Jack Scott
Jack Scott

Posted on

PS7-Completion: Tab completion for Git, SSH and WinGet in PowerShell

The idea for PS7-Completion came from bash-completion. I wanted that same convenience in PowerShell: type part of a command, press Tab, and get some help with what comes next.

PowerShell already has tab completion, but the experience with command-line tools depends on which tool you’re using and what completion support you have installed. I wanted to make more of the commands I use feel familiar in that respect.

So I’m building PS7-Completion, an open-source module for PowerShell 7.4+ on Windows, with completion support for 34 tools.

Here’s what using it looks like.

You start typing a Git command:

git che
Enter fullscreen mode Exit fullscreen mode

Press Tab, and it completes to:

git checkout
Enter fullscreen mode Exit fullscreen mode

You can do the same with supported options. If you remember that Git has an option for a shorter log, start with:

git log --one
Enter fullscreen mode Exit fullscreen mode

Tab completes it to:

git log --oneline
Enter fullscreen mode Exit fullscreen mode

The WinGet equivalent might be an option you’ve used before but keep forgetting:

winget install --ex
Enter fullscreen mode Exit fullscreen mode

Press Tab:

winget install --exact
Enter fullscreen mode Exit fullscreen mode

You can continue typing from there. Pressing Tab fills in the suggestion; it doesn’t execute the command.

SSH completion also uses host aliases from your SSH config. If you have an alias called staging-web, typing this gives you a starting point:

ssh stag
Enter fullscreen mode Exit fullscreen mode

Press Tab to complete the matching name:

ssh staging-web
Enter fullscreen mode Exit fullscreen mode

It’s especially useful for tools you use just often enough to need them, but not often enough to remember their syntax. Opening the help output is fine. Opening it for the same option every few weeks gets old.

Alongside Git, SSH and WinGet, PS7-Completion covers tools including Docker, GitHub CLI, npm, pip, uv, Ruff, Cargo and ripgrep. The full list is in the README. Coverage varies between tools, and this is still an early release.

To try it, check that you’re running PowerShell 7.4 or newer:

$PSVersionTable.PSVersion
Enter fullscreen mode Exit fullscreen mode

Download the Windows installer from the latest release page, run it, and open a new PowerShell session.

Then load the module:

Import-Module PS7-Completion
Enter fullscreen mode Exit fullscreen mode

Try a few commands you normally use and press Tab while typing a subcommand or option.

If you decide to keep it, add that import line to your PowerShell profile so it loads in new sessions. The installer doesn’t edit your profile.

I’d appreciate feedback from people using it during ordinary terminal work. Pick a couple of tools you know well and see where the suggestions help or fall short.

If something is missing or a suggestion looks wrong, open an issue with what you typed before pressing Tab, what you expected, and your PowerShell and tool versions. Those examples help me decide what needs attention next.

PS7-Completion is available on GitHub under the MIT license. If a tool you use isn’t supported by the time you read this, open an issue and tell me which one. Include a few commands or options you’d like to complete so I know where to start.

Top comments (0)