doy / rbw

unofficial bitwarden cli
https://git.tozt.net/rbw
Other
581 stars 83 forks source link

Cannot source auto completion script for zsh #98

Closed jaypikay closed 12 months ago

jaypikay commented 1 year ago

To test the auto completion I have tried to source the output of gen-completions, but get an error message which breaks the initialization.

$ source <(rbw gen-completions zsh)
_arguments:comparguments:327: can only be called from completion function

Not sure if I am using it wrong, or if there is a problem with the generated script.

ealvar3z commented 1 year ago

Did you generate the completion script during compilation? a la this:

cargo run --release --locked --bin rbw -- gen-completions zsh >zsh-completions

jaypikay commented 1 year ago

I have installed it through the Community repository in Arch Linux. The PGKBUILD is doing it the way you described:

  # generate shell auto-completions
  for completion in bash fish zsh; do
    cargo run --frozen --release --bin rbw -- \
      gen-completions "$completion" > "$completion-completions"
  done
benedikt-bartscher commented 1 year ago

See https://github.com/ahmetb/kubectx/issues/285

doy commented 12 months ago

yeah, the intended way to use this is to put the generated script on your fpath. i'm not sure what just sourcing the output directly would do, but it's not something intended to be supported.