cli-microsoft365: Bug report: The file that provides a tab completion in PowerShell is missing

Description

I’ve installed Office 365 CLI beta (2.10.0-beta.9e086a8) in Azure Cloud Shell.

The Register-O365CLICompletion.ps1 file that should provide a tab completion for Office 365 CLI in PowerShell is missing.

/home/<USERNAME>/.npm-global/lib/node_modules/@pnp/office365-cli/scripts/Register-O365CLICompletion.ps1 doesn’t exist.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 16 (12 by maintainers)

Commits related to this issue

Most upvoted comments

@garrytrinder all looking good👍 … the PS script is added to my $profile , is executed and I do get tab completion in my PS 7 terminal

m365 flow connector

  CLI for Microsoft 365 v3.0.0-beta.577f614
  Manage Microsoft 365 and SharePoint Framework projects on any platform

@garrytrinder and @westerdaled I had the same issue; just added it: #1793. Also think I identified the cause already.

We have just released a new preview version that should have this issue fixed. Once again sorry for the inconvenience and thank you for bringing it to our attention 👏

Rather than including all scripts in the package, I’ve included only the PowerShell completion registration script. Other, admin-related scripts are still excluded to keep things clean for users.

@garrytrinder seems like we’re excluding the scripts folder in .npmignore, so while it works locally with npm link it doesn’t when the package is installed by itself because the folder isn’t there 😦

https://github.com/pnp/office365-cli/blob/b3d1515a82b701a099d803943a14fa7a97d9b6b0/.npmignore#L7

Removing scripts from .npmignore should fix the issue. Good catch @alexandair and pretty bad that we haven’t spotted it earlier.

hi @garrytrinder , I am happy to try the next beta release if this issue has now been resolved.

Thanks for letting us know @westerdaled could I ask you to raise a new issue to highlight the behaviour you are seeing, so that it is more visible to others and we will investigate. Thank you.

Reproduced on my windows 10 machine (node v12.14.1) and cli version 2.9.0

I also have this issue locally when installing the CLI globally, using either the @latest & @next releases.

image

Interestingly, I had setup completion previously on my machine with no issues, it however transpires that this was working fine for me due to having the CLI source on my machine for development which I had created a symlink to using npm link.

Therefore, the path added to my PowerShell profile when executing o365 cli completion pwsh setup command was to this local folder where the Register-O365CLICompletion.ps1 exists in the scripts folder.

It looks like the scripts folder is missing from the npm package.

@waldekmastykarz would you be able to take a look at this?