- Get the Plaster Module from Plaster Github
- Get the latest version of the VS Code Powershell Extension.
- Create a zip file of the contents of the NewModuleTemplate folder in the Examples.
- Set the TemplatePath variable in the ps1 file below to the path of the zip.
- Set a Destination directory in the ps1 below.
- Either place the code below in the Microsoft.VSCode_profile.ps1 profile or highlight and hit f8 to temporarily load it for testing.
- Start the Command Palette by pressing f1 or ctrl+shift+P
- type 'addi' and hit enter (Short for Show additional commands for powershell modules)
- Enter the information prompted.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Invoke-TestCommand { | |
$Extensions = Get-Childitem -path "$Env:USERPROFILE\.vscode-insiders\extensions\gerane*" -Directory | |
$caption = "Please select a an Extension" | |
$message = "Package.json will be launched" | |
[int]$defaultChoice = 0 | |
$Choices = [System.Management.Automation.Host.ChoiceDescription[]] @($Extensions.Name) | |
$TestParam = $host.ui.PromptForChoice($caption,$message, $choices,$defaultChoice) | |
$ExtDir = $Extensions[$TestParam].FullName |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-CommandChoice | |
{ | |
[CmdletBinding()] | |
param | |
( | |
[Parameter(Mandatory=$true)] | |
[Array]$Array, | |
[Parameter(Mandatory=$true)] | |
[string]$caption, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Import-Module -Name Emojis | |
function Invoke-Emoji { | |
$context = $psEditor.GetEditorContext() | |
$EmojiText = $context.CurrentFile.GetTextLines($context.SelectedRange) | |
$Emoji = Get-Emoji -Name $EmojiText | |
if ($Emoji) | |
{ | |
$context.CurrentFile.InsertText($Emoji, $context.SelectedRange) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Import-Module -Name Emojis | |
function Invoke-EmojiSelection { | |
param([Microsoft.PowerShell.EditorServices.Extensions.EditorContext]$context) | |
$EmojiText = $context.CurrentFile.GetText($context.SelectedRange) | |
$Emoji = Get-Emoji -Name $EmojiText | |
if ($Emoji) | |
{ | |
$context.CurrentFile.InsertText($Emoji, $context.SelectedRange) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<plasterManifest version='0.1.0'> | |
<metadata> | |
<id>Unique-Template-Pkg-Name</id> | |
<!-- For display by UI's in a menu list --> | |
<title>New Toolkit</title> | |
<!-- For display by UI's in hover help --> | |
<description>Plaster template for creating the files for a PSAppDeploy Toolkit.</description> | |
<version>0.1.0</version> | |
<tags>Toolkit, Build</tags> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Invoke-PlasterToolkit | |
{ | |
[CmdletBinding()] | |
param | |
( | |
[Microsoft.PowerShell.EditorServices.Extensions.EditorContext]$context, | |
[Parameter(Mandatory=$true)] | |
[string]$Name = (Read-Host 'Please type Toolkit Name') | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Import-Module Emojis | |
function Invoke-EmojiSelection | |
{ | |
[Cmdletbinding()] | |
param | |
( | |
[Microsoft.PowerShell.EditorServices.Extensions.EditorContext]$context | |
) | |
$EmojiText = $context.CurrentFile.GetText($context.SelectedRange) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Register-EditorCommand ` | |
-Name "Helpers.EditVSCodeProfile" ` | |
-DisplayName "Edit VS Code Profile" ` | |
-SuppressOutput ` | |
-ScriptBlock { | |
param([Microsoft.PowerShell.EditorServices.Extensions.EditorContext]$context) | |
$psEditor.Workspace.OpenFile("$env:USERPROFILE\OneDrive\PowerShell\Profiles\Microsoft.VSCode_profile.ps1") | |
} | |
Register-EditorCommand ` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function EnsureServiceStarted { | |
param($Name) | |
Start-Service -name $name | |
$service = Get-Service -Name $name | |
$service.Status -eq [ServiceProcess.ServiceControllerStatus]::Running | |
} | |
Describe "Ensure service is started" { | |
It "Started service returns true" { | |
mock start-service {} |