Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.
If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!
In what situations is `.AHPARAMETER` expected to do anything?
-
I've been trying to get working some of the behaviours described in Augmented Help, so that Otter might generate rudimentary input UI for my ad-hoc scripts. However, I must be reading it wrong, because nothing I seem to do with these makes any difference.
Consider the rudimentary OtterScript...
/* .AHPARAMETERS .AHPARAMETER TestA(input, text) This is a simple test input .AHPARAMETER TestB(input, list, values='optA,optB' default='optA') This is another test input, with allowed values limited to specific items .AHPARAMETER TestC(input, text, sensitive) This is a third test input, which might render as a password field */ Log-Information "A test -- this is unimportant";...or a similar rudimentary PowerShell...
<# .AHPARAMETER TestA(input, text) .AHPARAMETER TestB(input, list, values='optA,optB' default='optA') .AHPARAMETER TestC(input, text, sensitive) #> Param( [String] $TestA, [String] $TestB, [String] $TestC, [Switch] $TestD ) Write-Output "A test -- this is unimportant"When creating an ad-hoc job to run these (i.e. from the
button in the list within the Scripts screen), I anticipate that input fields should be shown for $Test1,$Test2,$Test3, etc., with certain special attributes applied.However...
- the PowerShell ad-hoc job shows the input parameters derived from the
Paramblock (including a checkbox for$TestD), but does not present a list for$TestB, nor does it mask the sensitive$TestC. - the OtterScript ad-hoc job never shows any input parameters at all.
The only way I can get input parameters to show reliably is to create an associated Job Template and define them there (using the Job Template GUI or directly in the Raft JSON), but that obviously requires keeping two different parameter sets in sync (i.e. the one in the script and the one in the template); and these never apply to an ad-hoc script execution.
The implication in the documentation is that Augmented Help is designed to keep this in one place, and is the preferred way to apply these attributes.
What am I missing here? What is the "right" way to document my parameters such that the UI might pick it up?
Some more-targeted stuff I've tried
(this may or may not be relevant...)
A cursory scan of the decompiled
PowerShellScriptParameterInfo.Parse(...)from Scripting.dll suggests that the pattern used to extract values from a comment-based help block only picks these up if they are in the form....AHPARAMETER TestC input, text, sensitive(i.e. not
.AHPARAMETER TestC(input, text, sensitive)as in the documentation.) I've tried this form, both with and without the surrounding brackets, but it makes no difference.The same decompilation does not refer to
AHPARAMETERin the code, althoughAHEXECMODE,SYNOPSIS,DESCRIPTIONandPARAMETERare referenced.The nearest equivalent I can find for OtterScript may be in the decompilation of
OtterScriptLanguagein OtterCoreEx.dll, which has methodsGetParameters(...)andParseScriptInfo(...). Neither of these seem to mentionAHPARAMETEReither (although the former has a check forif (!additionalHeader.StartsWith("Parameter")) {...}. I can't follow it back far enough to see howadditionalHeaderis populated though.I can see in similar decompilations that the script engines for Batch, Shell and Python seem to favour
# AhParameters(plural) or# AhArgFormat-- I've tried similar strings in my OtterScript and PowerShell scripts (e.g..AHPARAMETERSand.AHARGFORMAT).I note very similar documentation for BuildMaster (2,3) as well, but I haven't got one of those in place with which to test.
- the PowerShell ad-hoc job shows the input parameters derived from the
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login