0

I'm probably missing something very obvious since I hadn't come across this question or an answer...but is it possible to allow for tab completion when a user is prompted to enter a mandatory parameter value, when they forgot to include the mandatory parameter?

Take the below sample code, if a user runs Test-TabComplete -number tab completion obviously works as expected. But, if the user runs Test-TabComplete without -number and they're prompted to enter a number, tab completion won't work. The HelpMessage will at least give the user some assistance, but tab completion would be great. I'm assuming I'm meant to do something with argumentcompleter? But the ultimate goal is to accomplish tab completion in a dynamic parameter, so I'm not too sure how to use argumentcompleter there, either.

function Test-TabComplete 
{
    param
    (
        [Parameter(
            Mandatory,
            Position = 1,
            HelpMessage = "Enter: 1, 2, 3"
        )]
        [validateset(1,2,3)]
        [int]$number
    )
}
Nvlddmkm
  • 31
  • 5

0 Answers0