VeryGoodOpenSource / cli_completion

Completion functionality for Dart Command-Line Interfaces built using CommandRunner. Built by Very Good Ventures. 🦄
https://pub.dev/packages/cli_completion
MIT License
49 stars 4 forks source link

fix: `.../.dart-cli-completion/zsh-config.zsh:3: unknown condition: -f` error #52

Closed pattobrien closed 1 year ago

pattobrien commented 1 year ago

Description

I'm receiving the following error after the first installation of cli_completion (via sidecar init from my package sidecar).

Steps To Reproduce

  1. Run sidecar init (which uses cli_completion as the command runner)
  2. Close the current terminal window and open a new one.

Expected Behavior

No error / proper use of cli_completion.

Additional Context

Here's the contents of the generated ~/.dart-cli-completion/zsh-config.zsh file:

## [Sidecar CLI] 
## Completion config for "Sidecar CLI"
[[ -f /Users/pattobrien/.dart-cli-completion/Sidecar CLI.zsh ]] && . /Users/pattobrien/.dart-cli-completion/Sidecar CLI.zsh || true
## [/Sidecar CLI]

I haven't looked into how to resolve the issue manually, as I'm not sure the intention of the above script. Any advice on how to proceed would be appreciated; thanks!

renancaraujo commented 1 year ago

This is caused because the executableName of your command runner is "Sidecar CLI" which is invalid (should be one word or separated by _ or -). executableName should be the same as the one on the pubspec.yaml under the field executables.

pattobrien commented 1 year ago

Oh yeah, I guess that makes sense... I thought that name was supposed to represent a friendly name, not the actual executable name.

I changed it and no longer get the issue - thanks a lot for the help @renancaraujo!