Reputation: 13983
Default argument completer for string argument is just a path.
However, if required argument is not supplied, user is presented with the prompt to enter argument value, but tab completion is not working in that case.
Is it possible to enable it for the prompt as well?
Upvotes: 1
Views: 85
Reputation: 174505
Is it possible to enable [file system tab-completion] for the prompt as well?
That depends entirely on the host application!
The prompt implementation in the default host applications (powershell.exe
/pwsh.exe
) are kept extremely simple for easy interoperability with legacy command line applications.
When the host application prompts for missing arguments, it's really last-resort exception avoidance - the caller failed to supply mandatory parameter arguments for the code they asked to invoke, and the command processor intervenes by asking the host application "Please, interrupt everything and try to give me some input, otherwise I can't proceed" - and the simplest way of implementing this intervention in a way that's compatible with the I/O characteristics of most command line tools is to just block until an input string is provided via stdin
.
If you're interested in developing your own host application to sit atop PowerShell's language engine, you can use whatever UI flow you want, as long as your host applications UI implements Prompt()
as a synchronous method that returns a dictionary of parameterName<->argument
bindings.
There's even an official sample application showing a rudimentary PSHostUserInterface
implementation with custom Prompt()
and PromptForChoice()
to get you started!
Upvotes: 1