July 24th, 2020 5 Minutes

As a windows user the terminal experience has always been lacking, up till the new windows terminal was released. Incorporating WSL (Windows Subsystem for Lynx) really helped bridge that gap as it opens up console experience that makes use of apt-get use the plethora of packages available.
Having tried using this for react apps I found the experience really slow when building apps. Running the same app in Powershell would start up in a fraction of the time. This got me thinking..
Can I evolve my Powershell console experience in the same way I can with WSL?
Looking at Powershells Gallery, they have a total of 7,091 unique packages. There must be some things here we can use.
This article is about my journey from reading this blog post "How to make a pretty prompt in Windows Terminal with Powerline, Nerd Fonts, Cascadia Code, WSL, and oh-my-posh" by Scott Hanselman, to taking the experience one step further to evolve my terminal. Video on it here:
Prerequisites
This article assumes you have already read Hanselman's article and kitted your terminal out with the following (if not do so):
- Added Cascadia Ligature Font, for more compact and expressive text.
- Added oh-my-posh, for better git branch information.
Making use of your Powershell profile
Before your Powershell window starts, any code in your Powershell profile is executed first. You can find your profile directory location by typing the following in your console,
$PROFILE
It's from this file we can begin importing in scripts and adding custom functions. If you followed the prerequisites, your profile file will be mostly empty except perhaps a command to set the theme in oh-my-posh.
Set-Theme Paradox
Incorporating packages
Before we start importing packages we need to get PowerShellGet setup, installation steps can be found here Installing PowerShellGet. Once complete you can start installing scripts like so,
Install-Module -Name WifiTools
That's it, you can actually start checking your wifi signal with Show-WifiState
📶! Aside from wifi tools here are some choice selections, some of these are recommended as it helps create building blocks for your own custom scripts:
1. Terminal Icons
Terminal-Icons really helps improve visibility when navigating. It also allows you to format your directory list wide so that you can see all the files and folders without scrolling down.
You can activate it in your Powershell profile by adding the following import
Import-Module -Name Terminal-Icons
And that's it! witness the beauty:
2. Tree
Tree helps with directory discover and searching by printing in (as the name suggests) a tree structure. I alias this package and mainly use it for listing and searching, below is what you need in your Powershell profile,
Install-Module -Name Tree
# Shows a tree structure of the current directory (excluding folders you want to ignore)
function treels {
Get-ChildItemTree . -I 'node_modules|bin|obj|.git|.vs'
}
# Searches the current directory for a pattern (wildcards * are accepted) and returns the tree view with matching files
function treef ([string] $pattern) {
Get-ChildItemTree . -P $pattern -I 'node_modules|bin|obj|.git|.vs'
}
Example showing a directory:
Example search for a file:
3. Burnt Toast
BurntToast great package to notify yourself of any long running tasks. It hooks into the native windows toast notification system and has a plethora of options. One ideal use for this is cloning a repo (I'm talking about that repo dating back to the dinosaurs 🐉) since it lets you kick it off and automatically get a notification when done.
Install-Module -Name BurntToast
# clones a repo and notify with a toast
function clonem([string] $url) {
git clone $url
New-BurntToastNotification -AppLogo 'C:\Icons\completed.png' -Text "Finished!", 'Finished cloning repo'
}
I also find it great for scheduling in reminders, this one is dependent on a function which I import at the top of the profile code example found here.
# IMPORT CUSTOM FILES
. "C:\Users\faese\Documents\WindowsPowerShell\Custom\BurntToast.ps1"
# trigger a remind after x minuites with some custom text
function reminder([int]$minuites, [string]$text) {
New-ToastReminder -AppLogo 'C:\Icons\reminder.png' -Minutes $minuites -ReminderTitle 'Reminder Reminder!' -ReminderText $text
}
Example to ensure you never eggless,
4. ColoredText
This library essentially allows you to print in different colours pure and simple. I mainly use this as a confirmation line when chaining together several commands so your eye just looks for coloured text to look for completion.
Install-Module -Name ColoredText
# create a new branch
function newb([string]$branchName){
git branch $branchName
git checkout $branchName --track
$message = "Finished creating branch: " + $branchName
cprint black $message on rainbow print
}
# publish branch
function publish {
$branchName = git rev-parse --abbrev-ref HEAD
git push --set-upstream origin $branchName
$message = "Finished publishing branch: " + $branchName
cprint black $message on rainbow print
}
Some other honourable mentions
Below are some other honourable mentions that I needed more time to investigate,
- PS Menu, allows you to create a multi-select menu of options.
- WTToolBox, helps manage your windows terminal, I was mainly going to use this to get a list of shortcuts.
Download my profile code here
You can download my complete profile code here
Summary
I'm still on a path of discovery with Powershell, I've seen some great packages that can help make my terminal experience fast and efficient. However, I do feel I'm at the very beginning of this journey and with the continued improvements to WSL, I may flip flop to the Linux side.