2015-06-22

Announcing Paket.PowerShell

I'm happy to announce that Paket.PowerShell is now available and ready to be used. It is installable using Chocolatey. It exposes the paket.exe commands as PowerShell commands. Tab completion of commands, parameters, and arguments works in both powershell.exe and the Visual Studio Package Manager Console.

Tab Completion of Commands

I chose to use Paket as the prefix instead of a standard verb. It provides easier discovery of Paket commands and is more in sync with paket.exe.


Tab Completion of Parameters

This comes standard with PowerShell, but it is still pretty awesome. If you just type a dash and hit tab you will get a list of all parameters including the Powershell common parameters.


Tab Completion of Arguments

Tab completion or arguments works for several parameters. See ArgumentTabCompletion.ps1 for a complete list.



Technical Achievements

I'm hoping the work I've done provides a good example of combining PowerShell and Chocolatey together as well as PowerShell and F# together.

Installation

PowerShell Getting Started

If you are just getting started with PowerShell, know that the tab key is your friend. Pressing the tab key allows you to complete parameters and frequenty arguments too. If there are multiple values, pressing the tab key repeatedly will cycle through them. Get-Help is very helpful too.
  • Get-Help Set-ExecutionPolicy -Online
The command will open up your browser to this help page about Set-ExecutionPolicy. Windows ships with PowerShell locked down to Restricted, but to be able to do anything useful with PowerShell, the first step that stumps everyone is that they need to make this setting less restrictive. It is common to change this to RemoteSigned. You must run Set-ExecutionPolicy as Administrator. I usually launch PowerShell as administrator by holding down ctrl + shift and clicking on the PowerShell in the taskbar or the start screen.
  • Get-ExecutionPolicy -List | Format-Table -AutoSize
  • Set-ExecutionPolicy RemoteSigned -Scope LocalMachine -Force

Scott Hanselman blogged about this topic in 2006. A newer 2014 article covers this topic in detail.

Chocolatey Getting Started

Chocolatey is a great way to distribute Windows software. Installing Chocolatey and most commands need to be run as administrator. The easiest way is simply to download and run their install script.
  • iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
By default, the Chocolatey Gallery is the only source. Any NuGet feed may be added as a source, including private NuGet feeds from AppVeyor, MyGet, and at your company. I recommend adding the NuGet Gallery public feed. 
  • choco source list
  • choco source add -n=nuget -s=https://www.nuget.org/api/v2

Here is the software I have installed on this laptop using Chocolatey.
  • choco list --localonly

Installing Paket.PowerShell

Paket releases upload Paket.PowerShell to both the NuGet Gallery and the Chocolatey Gallery. Unfortunately, it isn't yet whitelisted on Chocolatey and newer versions are waiting for moderation. If you add the NuGet Gallery as a source, you will get the latest version when you do an install. Another option is to specify the version when doing the install.
  • choco install Paket.PowerShell -y