cli-microsoft365 icon indicating copy to clipboard operation
cli-microsoft365 copied to clipboard

Bug report: Command Completion does not seem to work in PoSh 5, it does in PoSh 7 though.

Open martinlingstuyl opened this issue 2 years ago • 3 comments

Description

Using the help section here I configured Auto completion. But I can't get it to work on PoSh 5. While on PoSh 7 it works like a glove.

The $profile files all contain the right content referring to the right Register-CLIM365Completion.ps1 file. No error is thrown on registering or on autocompleting, it just does not work.

Steps to reproduce

Follow the manual on PoSh 5

Expected results

Like it says in the manual

Actual results

Nothing. No feedback, no results.

Diagnostics

No response

CLI for Microsoft 365 version

5.4.0 (next)

nodejs version

16.15.0

Operating system (environment)

Windows

Shell

PowerShell

cli doctor

No response

Additional Info

No response

martinlingstuyl avatar Jun 10 '22 15:06 martinlingstuyl

Have you confirmed if the PowerShell profile is update with the completion registration and if the profile is actually loaded in the PowerShell session?

waldekmastykarz avatar Jun 11 '22 12:06 waldekmastykarz

Yes certainly! I checked the contents of the profile files and to be sure added some write-host logging just above the loading of the Register ps file. Those all came through fine.

martinlingstuyl avatar Jun 11 '22 14:06 martinlingstuyl

Is Register-ArgumentCompleter a thing in PowerShell 5? If so, it would be interesting to debug it and see what's coming through and if our logic stands in PowerShell 5.

waldekmastykarz avatar Jun 11 '22 17:06 waldekmastykarz

Looking at the docs, Register-ArgumentCompleter should work just fine in PowerShell 5.1. Can you double check which version of PowerShell you were using and wasn't working @martinlingstuyl?

waldekmastykarz avatar Aug 29 '22 17:08 waldekmastykarz

Just did some testing and the problem was with our usage of the Join-Path commandlet @waldekmastykarz. I fixed it and created a PR 👍

martinlingstuyl avatar Aug 29 '22 20:08 martinlingstuyl