Skip to content

Instantly share code, notes, and snippets.

View Morten242's full-sized avatar

Mårten Nordheim Morten242

View GitHub Profile
@Morten242
Morten242 / ninja-complete.ps1
Last active July 13, 2021 11:20
Ninja tab-completion for PowerShell
$ninjaCompleteBlock = {
param($wordToComplete, $commandAst, $cursorPosition)
$toComplete = [Regex]::Escape($wordToComplete)
Select-String .\build.ninja -pattern "^build ($toComplete[\w-]*[\\/]?)[\w-]*:"
| ForEach-Object { $_.Matches.Groups[1].Value.Trim() }
| Sort-Object -CaseSensitive
}
Register-ArgumentCompleter -CommandName ninja -Native -ScriptBlock $ninjaCompleteBlock

Keybase proof

I hereby claim:

  • I am morten242 on github.
  • I am morten242 (https://keybase.io/morten242) on keybase.
  • I have a public key ASAqj3yQuNpV_Jt3sEC1Xda4ScLrnwzRGdTC3Bvrn2oJawo

To claim this, I am signing this object:

Param (
[ValidateSet('amd64', 'x86', 'x64', 'x86_amd64', 'x86_arm', 'x86_arm64', 'amd64_x86', 'amd64_arm', 'amd64_arm64')]
[Parameter(Mandatory = $false, Position = 1)]
[string]$Arch = "x64",
[ValidateSet('', 'UWP', 'Store')]
[Parameter(Mandatory = $false, Position = 2)]
[string]$Type = "",
[Parameter(Mandatory = $false, Position = 3)]