gsamokovarov / jump

Jump helps you navigate faster by learning your habits. ✌️
http://gsamokovarov.com/jump
MIT License
1.8k stars 59 forks source link

Add PowerShell integration #71

Closed ins0mniaque closed 2 years ago

ins0mniaque commented 2 years ago

This pull request adds support for PowerShell by proxying the commands for 'cd' and 'pushd' (i.e. Set-Location and Push-Location) and calling jump chdir, and registering an ArgumentCompleter for the bound function which calls jump hint.

Works by adding the following line to the PowerShell profile:

Invoke-Expression (&jump shell pwsh | Out-String)

It also contains tests for jump shell pwsh based on the existing shell integration tests.

For the README.md and snap package description, I tried to make the instructions as clear as possible; the PowerShell profile location differs depending on version and OS.

NOTE: I also fixed a small typo in fish shell integration instructions: "put the line below needs to be in" => "the line below needs to be in"

gsamokovarov commented 2 years ago

Oh, man, I wanted this for so long but never stayed in Windows-land long enough to learn PowerShell. Thank you so much!

Is there a convenient way to distribute a Windows package? Is NuGet widely used?

ins0mniaque commented 2 years ago

I'm actually using PowerShell under macOS, so I used the brew package.

NuGet is widely used, but is not really for packaging executables. There are 3 popular package managers for Windows: Chocolatey, Scoop and Winget.

Personally I prefer Scoop as it's the most "brew" like, it doesn't require admin rights to install packages. Winget is by Microsoft and got a lot of traction recently. I also think Winget is now bundled by default with Windows 11.

There's also the possibility to package it as a multi-target "dotnet global tool" using NuGet, which would allow dotnet tool install -g jump to work on any platform (as long as the .NET SDK is installed). But creating the multi-target NuGet Package is a lot more work.

gsamokovarov commented 2 years ago

Thanks for the clarification, I'll try to get at least on winget.