diff --git a/StackMonkey.ps1 b/StackMonkey.ps1 index fbfcef7..6f4cfc7 100644 --- a/StackMonkey.ps1 +++ b/StackMonkey.ps1 @@ -88,7 +88,8 @@ # 1) ENTRYPOINT + PARAMETER DECLARATION # ───────────────────────────────────────────────────────────────────────── - + function Invoke-ScriptMonkey { + [CmdletBinding( DefaultParameterSetName='UI', SupportsShouldProcess=$true, @@ -1564,4 +1565,16 @@ $script } #endregion ScriptMonkey run silently Entrypoint + } + + if ($MyInvocation.InvocationName -eq '.') { + # dot-sourced, don't invoke +} elseif ($PSCommandPath) { + # script was saved and run directly + Invoke-ScriptMonkey @PSBoundParameters +} else { + # iwr | iex fallback + Invoke-ScriptMonkey +} +