Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shresht7/psfavorite
Favorite PowerShell commands to get as PSReadLine Predictions
https://github.com/shresht7/psfavorite
command-line powershell powershell-module psreadline
Last synced: about 1 month ago
JSON representation
Favorite PowerShell commands to get as PSReadLine Predictions
- Host: GitHub
- URL: https://github.com/shresht7/psfavorite
- Owner: Shresht7
- License: mit
- Created: 2022-12-16T11:28:06.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-07T12:36:16.000Z (6 months ago)
- Last Synced: 2024-08-13T07:05:07.199Z (3 months ago)
- Topics: command-line, powershell, powershell-module, psreadline
- Language: PowerShell
- Homepage:
- Size: 182 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# `PSFavorite`
This module allows you to mark commands as **favorites**. Your favorite commands will appear as suggestions in the PSReadLine Predictor Views.
Favorites do not replace history, they complement it. The history tracks _everything_ you've done, and favorites track the things that you've _deemed important_.
![demo](./demo.gif)
---
## ๐ Usage
Write a command and press Ctrl + Shift + * to mark it as _favorite_.
![screenshot](./add-to-favorites.png)
> `Note:` Add a helpful comment to describe the command for future reference.
**Alternatively**, use the `Add-Favorite` cmdlet
```powershell
PS C:\> "Get-Command | Get-Random | Get-Help # Get help about a random command" | Add-Favorite
```> `Note:` Remember to wrap the expressions in quotes!
Your _favorite commands_ will start appearing as suggestions in the **PSReadLine Predictor View**.
---
## ๐ Requirements
- PowerShell v7.2.0 or higher
- PSReadLine v2.2.2 or higherPSReadLine must allow plugins as a `-PredictionSource`. (i.e. `Plugin` or `HistoryAndPlugin`)
```powershell
Set-PSReadLineOption -PredictionSource HistoryAndPlugin
```To enable the `List` view:
```powershell
Set-PSReadLineOption -PredictionViewStyle ListView
```## ๐ฆ Installation
### 1. Install the Module
```powershell
Install-Module -Name PSFavorite
```### 2. Import the Module
```powershell
Import-Module -Name PSFavorite
```> Add this to your `$PROFILE` if you wish to enable this for every session.
## ๐ช Uninstallation
1. Close **all** PowerShell instances
2. Launch a PowerShell session with no profile. `pwsh -NoProfile`
3. Uninstall the Module. `Uninstall-Module -Name PSFavorite -Force`
4. Close PowerShell---
## ๐ฝ Development
### ๐ Scripts
- [`Build.ps1`](./Build.ps1) - Builds the PowerShell module
### ๐งช Testing
This module uses [Pester](https://pester.dev/) for testing. Run the following command to test the PowerShell module.
```pwsh
Invoke-Pester
```## ๐ Reference
- https://learn.microsoft.com/en-us/powershell/scripting/dev-cross-plat/create-cmdline-predictor?view=powershell-7.3
---
## ๐ License
This project is licensed under the [MIT License](./LICENSE). Please read the [LICENSE](./LICENSE) for more details.