The Extensions Name. Accepts WildCards.
Type: String[]
Parameter Sets: ExtensionName
Aliases:
Required: True
Position: Named
add-type -TypeDefinition @" | |
using System; | |
public static class KeyboardEventTestUtil { | |
public static string keybd_event(byte bVk, byte bScan, UInt32 dwFlags, System.UIntPtr dwExtraInfo) { | |
return string.Format("{0}:{1}:{2}:{3}", bVk,bScan,dwFlags,dwExtraInfo); | |
} | |
} | |
"@ | |
describe "t" { |
Register-EditorCommand ` | |
-Name "MyModule.OpenPowerShellConsole" ` | |
-DisplayName "Open PowerShell Console" ` | |
-SuppressOutput ` | |
-ScriptBlock { | |
$Arch = (Get-WmiObject -Class 'Win32_Processor').AddressWidth | |
If ($Arch -eq '64') | |
{ | |
#launch powershell via sysantive here |
# Is there a reason why one might use Example 1 over Example 2 if only using a single command? | |
## Example 1 | |
New-Module -Name SomeModule -Function "SomeFunction" -ScriptBlock { Function SomeFunction { Write-Host "Invoking SomeFunction with $params"} } | Import-Module | |
## Example 2 | |
Function SomeFunction { Write-Host "Invoking SomeFunction with $params"} | |
## Example Usage | |
Describe "Invoke-Something" { |
function Test-WildCardsWorks | |
{ | |
[CmdletBinding()] | |
param | |
( | |
[Parameter(Mandatory=$true, | |
Position=0, | |
ParameterSetName="Path", | |
ValueFromPipeline=$true, | |
ValueFromPipelineByPropertyName=$true, |
Register-EditorCommand ` | |
-Name 'ToDo.InsertToDo' ` | |
-DisplayName 'Insert ToDo' ` | |
-SuppressOutput ` | |
-ScriptBlock { | |
param([Microsoft.PowerShell.EditorServices.Extensions.EditorContext]$context) | |
$Message = Read-Host 'Please enter Todo Message' | |
$ToDo = "# [$((Get-Date).ToShortDateString())] ToDo: $($Message)" | |
$context.CurrentFile.InsertText($ToDo, $context.CursorPosition) | |
} |
{ | |
"function": { | |
"prefix": "func", | |
"body": [ | |
/* Test Comment*/ | |
"function ${name:Verb-Noun}", | |
"{", | |
"\t[CmdletBinding()]", | |
"\tparam", | |
"\t(", |
Update-MarkdownHelp
try to fill in all attribute like the following.
Write-Host "`nI" -NoNewLine -ForegroundColor DarkGray | |
Write-Host " ❤ " -NoNewLine -ForegroundColor DarkRed | |
Write-Host "PS>" -NoNewLine -ForegroundColor DarkGray |
function global:prompt | |
{ | |
$realLASTEXITCODE = $LASTEXITCODE | |
$Host.UI.RawUI.ForegroundColor = $GitPromptSettings.DefaultForegroundColor | |
$Host.UI.RawUI.ForegroundColor = "White" | |
Write-Host $PWD.ProviderPath -NoNewLine -ForegroundColor Green | |
Write-VcsStatus | |
$global:LASTEXITCODE = $realLASTEXITCODE |