Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
CthulhuShell
function πŸ™ {
$name,$params = $args.Where({$_ -eq 'πŸ’©'},'Until')
$null,$body = $args.Where({$_ -eq 'πŸ’©'},'SkipUntil')
$params = @($params |? {$_})
$func = @"
param($(($params |% {"`${$_}"})-join','))
$(($params |% {$body = $body -replace "($([regex]::Escape($_)))",'(&$${$1})'}))
$body
"@
"function global:$name {$func}" |Invoke-Expression
}
πŸ™ 1️⃣ πŸ’© 1
πŸ™ 2️⃣ πŸ’© 2
πŸ™ βž• πŸ…°οΈ πŸ…±οΈ πŸ’© πŸ…°οΈ+πŸ…±οΈ
βž• 1️⃣ 2️⃣
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment