Add command-completion for PowerShell invocation command line
Summary of the new feature/enhancement
Command-completion (tab-completion) is a nice capability It would be helpful to have command-completion for parameters when invoking PowerShell from a PowerShell console.
Hi @Liturgist, I want to verify I understand your feature request, from within a PowerShell console or terminal running PowerShell, you want tab-completion to complete the pwsh.exe syntax below?
pwsh[.exe] [-Login] [[-File] <filePath> [args]]
[-Command { - |
@theJasonHelmick I'm pretty certain you're right and that's what they're asking for. A build in argument completer for it would be great, I always found it strange that there wasn't one.
This issue has been marked as "Waiting on Author" and has not had any activity for 7 day. It has been closed for housekeeping purposes.
@theJasonHelmick, yes, I believe you understand correctly. My apologies for inattention. I still think this would be a helpful addition.
@Liturgist - Thank you for the response and the suggestion -- I think this could be a benefit to customers unfamiliar with pwsh.exe syntax. I'll discuss further with the working group and report back.
We could add completer for pwsh.exe (Register-ArgumentCompleter)
@Liturgist @iSazonov -- After discussing this with the working group, we agree that this would be a beneficial feature for users. I'm marking this up-for-grabs if the community would like to consider building this solution.
Would it be OK to add a reference to System.CommandLine?
Would it be OK to add a reference to System.CommandLine?
Any reference we add essentially version locks that library for anyone else who wants to consume it. There's a pretty high bar for impact that needs to be hit for that to be considered
On the other hand, others would run into issues using diffferent version of System.CommandLine. It may not be the worst to have it in a dependable way, and it would make writing native completers much easier.
This is still the case. Just waiting for someone to take it on.
PS C:> $psversionTable.psversion.ToString() 7.3.9
This is still the case.
PS C:> $PSVersionTable.PSVersion.ToString() 7.4.2
@Liturgist I'll take this on. Let me know if someone is already working on it.
I made an argument completer for pwsh!
https://gist.github.com/jshigetomi/58cb79de086c804cda3173ef63d7dddf
Please leave some comments and ideas. I hope we can incorporate this completer during runtime once it's approved.
Gist
Tab completion for PowerShell parameters and some parameter arguments - PwshTabCompletion.ps1
@jshigetomi, I will look forward to trying it out. Thanks.
This issue has not had any activity in 6 months, if there is no further activity in 7 days, the issue will be closed automatically.
Activity in this case refers only to comments on the issue. If the issue is closed and you are the author, you can re-open the issue using the button below. Please add more information to be considered during retriage. If you are not the author but the issue is impacting you after it has been closed, please submit a new issue with updated details and a link to this issue and the original.
@jshigetomi, many thanks for your work.
After running PwshTabCompletion.ps1, the completer produces the following parameter names.
-File, -f, -Command, -c, -CommandWithArgs, -cwa, -ConfigurationName, -config, ...
I was expecting...
-File, -Command, -ConfigurationFile, -ConfigurationName, CustomPipeName, ...
Where does CommandWithArgs come from? It does not appear to be in the pwsh help.
Usage: pwsh[.exe]
[-Login]
[[-File] <filePath> [args]]
[-Command { - | <script-block> [-args <arg-array>]
| <string> [<CommandParameters>] } ]
[-ConfigurationFile <filePath>]
[-ConfigurationName <string>]
[-CustomPipeName <string>]
[-EncodedCommand <Base64EncodedCommand>]
[-ExecutionPolicy <ExecutionPolicy>]
[-InputFormat {Text | XML}]
[-Interactive]
[-MTA]
[-NoExit]
[-NoLogo]
[-NonInteractive]
[-NoProfile]
[-NoProfileLoadTime]
[-OutputFormat {Text | XML}]
[-SettingsFile <filePath>]
[-SSHServerMode]
[-STA]
[-Version]
[-WindowStyle <style>]
[-WorkingDirectory <directoryPath>]