Created
May 22, 2016 16:26
-
-
Save gerane/c87a640337a9739da746a18e1b62682f to your computer and use it in GitHub Desktop.
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) | |
| $Emoji = Get-Emoji -Name $EmojiText | |
| if ($Emoji) | |
| { | |
| $context.CurrentFile.InsertText($Emoji, $context.SelectedRange) | |
| } | |
| } | |
| Register-EditorCommand ` | |
| -Name "Emojis.Invoke-EmojiSelection" ` | |
| -DisplayName "Replace selected text with emoji" ` | |
| -Function Invoke-EmojiSelection ` | |
| -SuppressOutput | |
| function Invoke-EmojiList | |
| { | |
| [Cmdletbinding()] | |
| param | |
| ( | |
| [Microsoft.PowerShell.EditorServices.Extensions.EditorContext]$context | |
| ) | |
| $Names = (Get-Command -name Get-Emoji).Parameters['Name'].Attributes.ValidValues | |
| $caption = "Please select an Emoji" | |
| $message = "Inserts Emoji at Cursor Position" | |
| [int]$defaultChoice = 0 | |
| $Choices = [System.Management.Automation.Host.ChoiceDescription[]] @($Names) | |
| $Name = $host.ui.PromptForChoice($caption,$message, $choices,$defaultChoice) | |
| $Emoji = Get-Emoji -name $Names[$Name] | |
| $context.CurrentFile.InsertText($Emoji, $context.CursorPosition) | |
| } | |
| Register-EditorCommand ` | |
| -Name "Emojis.EmojiFromList" ` | |
| -DisplayName "Inserts an Emoji from List" ` | |
| -Function Invoke-EmojiList ` | |
| -SuppressOutput | |
| function Invoke-PlasterTemplate | |
| { | |
| [CmdletBinding()] | |
| param | |
| ( | |
| [Microsoft.PowerShell.EditorServices.Extensions.EditorContext]$context, | |
| [Parameter(Mandatory=$true)] | |
| [string]$Name = (Read-Host 'Please type Toolkit Name') | |
| ) | |
| Process | |
| { | |
| $TemplatePath = "C:\Test\Templates\ModuleTemplate.zip" | |
| $Destination = "C:\Test\$Name" | |
| Invoke-Plaster -TemplatePath $TemplatePath -DestinationPath $Destination -ModuleName $Name | |
| } | |
| } | |
| Register-EditorCommand ` | |
| -Name "Plaster.PlasterTemplate" ` | |
| -DisplayName "Start Plaster Template" ` | |
| -Function Invoke-PlasterTemplate ` | |
| -SuppressOutput |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Awesome, thanks for having this out there.