Giter Site home page Giter Site logo

psfavorite's Introduction

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


๐Ÿ“˜ Usage

Write a command and press Ctrl + Shift + * to mark it as favorite.

screenshot

Note: Add a helpful comment to describe the command for future reference.

Alternatively, use the Add-Favorite cmdlet

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 higher

PSReadLine must allow plugins as a -PredictionSource. (i.e. Plugin or HistoryAndPlugin)

Set-PSReadLineOption -PredictionSource HistoryAndPlugin

To enable the List view:

Set-PSReadLineOption -PredictionViewStyle ListView

๐Ÿ“ฆ Installation

1. Install the Module

Install-Module -Name PSFavorite

2. Import the Module

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

๐Ÿงช Testing

This module uses Pester for testing. Run the following command to test the PowerShell module.

Invoke-Pester

๐Ÿ“• Reference


๐Ÿ“ƒ License

This project is licensed under the MIT License. Please read the LICENSE for more details.

psfavorite's People

Contributors

shresht7 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

psfavorite's Issues

Implement Fuzzy Search

Allow fuzzy matching so that the input only has to approximately match the favorited commands.

Path to the `Favorites.txt` file

private static string _FavoritesFilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "PowerShell", "Modules", "PSFavorite", "Favorites.txt");

The path to the favorites file is hardcoded here, it will be better if this was somehow configurable? (maybe environment variables).

Even if the file is supposed to co-exist within the module folder, this path is only valid for Windows.

Maybe ~/.config/PSFavorites/Favorites.txt should be the standard path.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.