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

Completion not working for 2.x in ZSH (at least) #200

Open
gcox opened this issue Dec 2, 2020 · 0 comments
Open

Completion not working for 2.x in ZSH (at least) #200

gcox opened this issue Dec 2, 2020 · 0 comments
Assignees

Comments

@gcox
Copy link
Contributor

gcox commented Dec 2, 2020

Describe the bug
Completion installation seems to complete, but logs an error at the end of the process. The correct scripts are generated
"error" is output every time you hit tab to attempt to use auto complete.
This happens with my own CLI app that I'm migrating from Caporal 1.x to 2.x as well as with the "pizza" example.

To Reproduce

  1. Clone the repo
  2. npm ci in the root
  3. npm run build in the root
  4. cd examples
  5. npm ci
  6. npm link
  7. pizza --install-completion
  8. Choose zsh
  9. Enter Y when prompted to install the completion to ~/.zshrc
  10. Observe the output. The last statement will be: "error: Unknown command --install-completion"
  11. Reload your shell
  12. enter pizza and hit tab
  13. Observe the output. The word "error" is output next to "pizza ".

Environment informations (please complete the following information):

  • OS: macOS on an Intel Mac
  • OS version: 11.0.1
  • Shell: zsh
  • Caporal version: 2.0.2 (master branch as of 540bd81)
  • node: 12.18.3
  • nvm: 6.14.8

Additional context
I suspected the issue may be tabtab but I cannot reproduce this issue using tabtab's example, which works as expected.

Output from my shell

  1. Output from pizza --install-completion
$ pizza --install-completion
? Which Shell do you use ? zsh
? We will install completion to ~/.zshrc, is it ok ? Yes
=> Tabtab line already exists in ~/.zshrc file
=> Tabtab line already exists in ~/.config/tabtab/__tabtab.zsh file
=> Wrote completion script to /Users/georgecox/.config/tabtab/pizza.zsh file

      => Tabtab source line added to ~/.zshrc for pizza package.

      Make sure to reload your SHELL.


error: Unknown command --install-completion.
  1. Output from entering pizza then hitting tab.
$ pizza error
  1. Running pizza completion also produces an error: "error: Unknown command completion". Since that's what the completion script calls, I'm guessing the completion command isn't getting registered correctly for some reason.

Update 1
Confirmed that the error being thrown when typing pizza + tab is, indeed, "Unknown command completion"

Update 2
It doesn't look like completion has worked at all in v2.x. The unit tests call complete directly and do not test whether it is called when the completion -- ??? command is run.

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

2 participants