With the new Windows Terminal available I’ve been searching on how to upgrade my console experience. I see a lot of people improving their terminal to show important information, like which Git branch you are working on, which Azure subscription, the actual location on disk, etc.
A couple of months ago I came across Brad Wilson his post on the matter and I like the way his terminal looks. His post, is rather straightforward, but there was some information missing. Well, ‘missing’ isn’t the correct word. In his post he has assumed some prerequisites which I hadn’t set up on my machine(s).
For reference sake, I’ll repeat some steps over here from Brad his post and add some of myself which were unclear to me.
First of all, you need to install posh-git. This is a small PowerShell module which integrates Git in PowerShell. It’s very useful and now that I know of it I advise everyone to use it!
I did have some versioning issues when installing this though. The first time when I ran the command `PS> install-module posh-git` I got the following message(s).
PowerShellGet requires NuGet provider version '220.127.116.11' or newer to interact with NuGet-based repositories. The NuGet provider must be available in 'C:\Program Files\PackageManagement\ProviderAssemblies' or 'C:\Users\jan\AppData\Local\PackageManagement\ProviderAssemblies'. You can also install the NuGet provider by running 'Install-PackageProvider -Name NuGet -MinimumVersion 18.104.22.168 -Force'. Do you want PowerShellGet to install and import the NuGet provider now? [Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): y Untrusted repository You are installing the modules from an untrusted repository. If you trust this repository, change its InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you want to install the modules from 'PSGallery'? [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"):
Eventually, I was able to get this to work, but I had to update my `PowerShellGet` repository first. As you can see from the script below, this also failed.
PS> install-module powershellget Untrusted repository You are installing the modules from an untrusted repository. If you trust this repository, change its InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you want to install the modules from 'PSGallery'? [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): a WARNING: Version '22.214.171.124' of module 'PowerShellGet' is already installed at 'C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\126.96.36.199'. To install version '2.1.2', run Install-Module and add the -Force parameter, this command will install version '2.1.2' in side-by-side with version '188.8.131.52'.
This is something which I could solve by using the `-force` flag. The three steps I had to execute in the end was this:
PS> install-module powershellget -force PS> install-module posh-git -force PS> update-module posh-git
The next thing you need is to install Nerd Fonts. This isn’t mandatory, only if you want cool looking icons in your terminal it is. And be honest, who doesn’t like cool icons in a terminal window?
I settled for the UbuntuMono.zip package, which contains all the fonts you need for this post.
Now that you have the basics installed, run the command `Add-PoshGitToProfile` to add posh-git to your PowerShell profile (and create one if you hadn’t got it already).
Keep in mind though, when proceeding with this post it is advised to install Git for Windows with complete UNIX support. This way you get all of the UNIX tools to your disposal as they are added to the %PATH% and you need some of these tools later when using Brad his scripts.
Now that all of the prerequisites are set up you can copy the files from Brad Wilson his Gist page to make your terminal look cool, no need for me to copy the contents over here.
Do keep in mind you need to edit and save the files in UTF-8/Unicode, otherwise, the icons won’t show up properly.
If you’ve done everything right, your terminal will look very similar to the picture below.
Of course, you can change anything you want in the scripts.
Please let me know which cool additions you have done to make your terminal even cooler.