When using the CLI in non-immersive mode in PowerShell, provide completion for commands and their options.
Additional information:
https://twitter.com/lzybkr/status/954359342001614849
https://twitter.com/lzybkr/status/954363715213672449
https://github.com/lzybkr/TabExpansionPlusPlus/blob/master/WindowsExe.ArgumentCompleters.ps1
https://github.com/lzybkr/TabExpansionPlusPlus
I have a working PoC. @VelinGeorgiev, @garrytrinder would you mind giving it a try to see if I haven't missed anything?
npm run buildo365 --completion:pwsh:setupo365[SPACE][TAB] > you should get list of suggestions for all commands in the CLIPlease experiment with the different combinations to check that we have everything that we need.
I'm struggling at step 4.
I get the Add to your PowerShell profile: message and the Register-O365CLICompletion.ps1 file is generated but not sure where my profile file is...
Executing $PROFILE in pwsh returns /Users/garrytrinder/.config/powershell/Microsoft.PowerShell_profile.ps1 as the profile location but the powershell folder doesn't seem to exist in the .config directory.
Any ideas?
I also can't change to the powershell directory in a terminal session.
It could be that the file doesn't exist and you need to create it yourself. See https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_profiles?view=powershell-7 for more info.
Thanks, I鈥檒l take a look later this evening 馃憤馃徎
Working great @waldekmastykarz 馃憦馃徎

For completeness these were the steps taken to setup my pwsh profile and completion
pwshif (!(Test-Path -Path $PROFILE)) { New-Item -ItemType File -Path $PROFILE -Force}nano $PROFILERegister-O365CLICompletion.ps1 file location to profile and saveexitpwsho365[SPACE][TAB]Awesome! Thanks for checking it out. What would be a proper way to have users set it up? I had a look and it seems like the profile path is not exposed in node in any way. We could ask user to pass it as an argument, o365 --completion:pwsh:setup --path $profile and then ensure that the file exists and append the reference to our completion to it or we could leave it be for now and describe it in the docs. What do you think?
No problem, happy to help 馃槉
Passing $PROFILE as a param would be a nice user experience, and we can explain why we need this in the docs.
I expect that this will be a feature that will get a lot of attention from users so making the process easy as possible, i.e. automating the manual steps described in the previous comment, will help its usage.