Instantly share code, notes, and snippets.

Embed
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