Skip to content

Instantly share code, notes, and snippets.

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
function Get-CommandChoice
{
[CmdletBinding()]
param
(
[Parameter(Mandatory=$true)]
[Array]$Array,
[Parameter(Mandatory=$true)]
[string]$caption,
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)
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)
<?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>

Getting Started

  • 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.
function Invoke-PlasterToolkit
{
[CmdletBinding()]
param
(
[Microsoft.PowerShell.EditorServices.Extensions.EditorContext]$context,
[Parameter(Mandatory=$true)]
[string]$Name = (Read-Host 'Please type Toolkit Name')
)
Import-Module Emojis
function Invoke-EmojiSelection
{
[Cmdletbinding()]
param
(
[Microsoft.PowerShell.EditorServices.Extensions.EditorContext]$context
)
$EmojiText = $context.CurrentFile.GetText($context.SelectedRange)
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 `
@gerane
gerane / TestingStartService.ps1
Created May 25, 2016 00:50 — forked from nohwnd/TestingStartService.ps1
Testing start service
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 {}