PSArm
PSArm copied to clipboard
PSArm affecting help
PS> help about_operators
Exception: Not enough parameters provided
PS> gerr
Exception :
Type : System.Management.Automation.RuntimeException
ErrorRecord :
Exception :
Type : System.Management.Automation.ParentContainsErrorRecordException
Message : Not enough parameters provided
HResult : -2146233087
CategoryInfo : NotSpecified: (:) [], ParentContainsErrorRecordException
FullyQualifiedErrorId : RuntimeException
WasThrownFromThrowStatement : True
Message : Not enough parameters provided
HResult : -2146233087
TargetObject : Not enough parameters provided
CategoryInfo : OperationStopped: (Not enough parameters provided:String) [], RuntimeException
FullyQualifiedErrorId : Not enough parameters provided
InvocationInfo :
ScriptLineNumber : 257
OffsetInLine : 28
HistoryId : -1
ScriptName : /Users/steve/.local/share/powershell/Modules/PSArm/0.1.0/ArmBuiltins.psm1
Line : if ($args.Count -lt 2){ throw 'Not enough parameters provided' }
PositionMessage : At /Users/steve/.local/share/powershell/Modules/PSArm/0.1.0/ArmBuiltins.psm1:257 char:28
+ if ($args.Count -lt 2){ throw 'Not enough parameters provided' }
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PSScriptRoot : /Users/steve/.local/share/powershell/Modules/PSArm/0.1.0
PSCommandPath : /Users/steve/.local/share/powershell/Modules/PSArm/0.1.0/ArmBuiltins.psm1
CommandOrigin : Internal
ScriptStackTrace : at less, /Users/steve/.local/share/powershell/Modules/PSArm/0.1.0/ArmBuiltins.psm1: line 257
at <ScriptBlock>, <No file>: line 144
at <ScriptBlock>, <No file>: line 1
Get-Help
does work, but for some reason the help
function calls into PSArm
What does gcm help
tell you?
Oh it's an ARM expression function
This is currently by design then -- those functions take the same names as ARM expression functions.
We could theoretically only define those functions within Arm
blocks, but I'm not sure if we should
Since arm expression functions could overlap with any existing command, it seems preferable for those to only exist within Arm
blocks, if possible. What would be the downside to that approach?
The only drawback I see is if you wanted to evaluate resources outside an ARM block.
Even with this change though you could still write those definitions in a separate script. You just wouldn't be able to evaluate them properly outside an ARM block.
It would be a pretty subtle behaviour, but perhaps only as subtle as anything else in the DSL.
The other option, which I don't like, is to prefix any conflicting functions. So in this specific case it would be armhelp
I guess which is pretty ugly. Or maybe better to have a suffix to not re-order the intellisense help-arm
which is pretty bad, too.
Yeah I definitely prefer the scoping option too