Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to use powerShellCompletion #1299

Closed
king-john opened this issue Dec 16, 2020 · 3 comments
Closed

how to use powerShellCompletion #1299

king-john opened this issue Dec 16, 2020 · 3 comments

Comments

@king-john
Copy link

king-john commented Dec 16, 2020

The cobra version I use is 0.0.7

Powershell version: 5.1

I use testcli completion powershell | Out-String | Invoke-Expression, but the completion is invalid on powershell .

I refer to Generating shell completions.

How to use it?

@Luap99
Copy link
Contributor

Luap99 commented Dec 16, 2020

see #1229

@king-john
Copy link
Author

@Luap99
No solution found at #1229
My Completion Item Description is not empty.
My Completion didn't work.

@anthonyfok
Copy link
Collaborator

anthonyfok commented Feb 9, 2021

@king-john Your Cobra version of 0.0.7 is too old.

Please use v1.1.1, or better, yet, or newer (master) e.g. by running go get -u github.com/spf13/cobra@master to get

github.com/spf13/cobra v1.1.2-0.20210209210842-07445ea179fc

which contains @Luap99's latest enhancements to PowerShell completion.

Also, please read the excellent documentation at https://github.com/spf13/cobra/blob/master/shell_completions.md written by Marc Khouzam (@marckhouzam) and Paul Holzinger (@Luap99). There is a near complete example which works out of the box.

Hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants