PowerShell module providing predictive text completions for common CLI tools.
Most people will be familiar with predictive text on mobile phones. Posh-predictive-text brings the same capability to the PowerShell command line interface for common CLI tools used within the software development and data science community.
Modern command line tools are highly configurable and have many parameters. It is difficult to remember them all. Posh Predictive Text improves productivity, not only by providing suggested completions, but also providing a pop-up list of suggestions with tooltips. These tooltips remove the need to break off from enter the command and search documentation for the correct parameter name.
In addition, Posh Predictive Text is also able to suggest a limited number of parameter arguments. For instance when using conda to activate an environment a list of environments is shown.
PoshPredictiveText provides suggested completions in the following situations:
- When a partial argument is entered and the
tab
key is pressed. Successive suggestion appear each time thetab
key is pressed. - Pressing
ctrl
+space
displays a popup list of options with tooltips. - If PSReadLine options
-PredictionSource
is set to use the plugin and-PredictionViewStyle
is set toListView
then suggestions will appear below the command line.
Demonstration.mp4
Predictive text is available for the following commands line tools.
- conda
If a tools is not supported then please consider helping by developing the syntax tree file needed to support it. Further information is available in the developer documentation.
We all love open-source software. It's the freedom to use it and adapt it as you like. Its the no cost option. However, without funding open-source projects die. If you find this software useful then consider sponsoring the developers. It doesn't have to be a lot. The cost of a cup of coffee will do. Little contributions help and it is all very much appreciated.
GitHub Sponsors:
Please use the button at the top of the page to contribute via GitHub sponsors.
Ko-fi:
PoshPredictiveText requires PowerShell version 7.2
or greater, and PSReadLine version 2.6
or
greater.
You can check the version of PowerShell using the following command.
$PSVersionTable.PSVersion
The latest version of PowerShell is available on Github.
You can check the version of PSReadLine using the following command.
Get-Module PSReadLine | Format-List
Version 2.2.6
is pre-release and to install it the AllowPreRelease
and -force
options are required.
Install-Module PSReadLine -AllowPrerelease -Force
Install PoshPredictiveText from the PowerShell Gallery. This will download the module to the local user account. You may be asked for permission if you have not already set PowerShell gallery as trusted source.
Install-Module -name PoshPredictiveText
Add the following commands to the PowerShell profile. To locate the PowerShell profile open
a command prompt and type $PROFILE
.
Set-PredictiveTextOption -RemoveCondaTabExpansion
Install-PredictiveText
The first command removes tab-expansion that is already installed by conda, and which prevents Posh Predictive Text from providing completions. The second command installs Posh Predictive Text.
Completions will appear when a partial argument is entered and the tab key is pressed. A longer list of options with tooltips is available by pressing ctrl-space.
It is recommended to add the following PSReadLine options in the PowerShell profile so that suggestions appear below the command line as command arguments are entered.
Set-PSReadLineOption -PredictionSource HistoryAndPlugin -PredictionViewStyle ListView
Contributions to the project are welcome. No developer is an island, there is never enough time to do everything and there is always another way to do things which may be better.
If you have a problem then raise an issue on the project issue tracker. If you have a suggested code improvement then submit a pull request.
If you wish to add support for another command line tool then read the developer documentation on the project web site. This will explain how the syntax tree files are developed, processed and integrated into the tool.
- Project homepage: https://posh-predictive-text.readthedocs.io
- Repository: https://github.com/DiaAzul/Posh-Predictive-Text
- PowerShell Gallery: https://www.powershellgallery.com/packages/PoshPredictiveText
- Issue tracker: https://github.com/DiaAzul/Posh-Predictive-Text/issues
- In case of sensitive bugs like security vulnerabilities, please contact
me using the
contact owners
form listed under info on the PowerShell Gallery page for the module https://www.powershellgallery.com/packages/PoshPredictiveText.
- In case of sensitive bugs like security vulnerabilities, please contact
me using the
The code in this project is licensed under the Apache-2.0 license.
The name Posh Predictive Text and associated trade marks are the property of Tanzo Creative Ltd.