[GH-ISSUE #1005] error when adding Completions #447

Closed
opened 2026-02-28 14:49:13 +03:00 by kerem · 3 comments
Owner

Originally created by @chrisgrieser on GitHub (Jul 30, 2022).
Original GitHub issue: https://github.com/Rigellute/spotify-tui/issues/1005

First of all, thank you for this fantastic app!

I was trying to add completions for the CLI. The help page only mentions spt --completions zsh, so I assume you add completions just like with other CLIs by using eval. However, when I try to run that, I get:

eval "$(spt --completions zsh)"
_arguments:comparguments:325: can only be called from completion function

I couldn't find any info in the readme or help page indicating that completions have to be added differently?

Originally created by @chrisgrieser on GitHub (Jul 30, 2022). Original GitHub issue: https://github.com/Rigellute/spotify-tui/issues/1005 First of all, thank you for this fantastic app! I was trying to add completions for the CLI. The help page only mentions `spt --completions zsh`, so I assume you add completions just like with other CLIs by using `eval`. However, when I try to run that, I get: ```zsh eval "$(spt --completions zsh)" _arguments:comparguments:325: can only be called from completion function ``` I couldn't find any info in the readme or help page indicating that completions have to be added differently?
kerem closed this issue 2026-02-28 14:49:13 +03:00
Author
Owner

@OrangeFran commented on GitHub (Sep 23, 2022):

Try adding the completions output to a location in your $fpath.
And the use autoload -U compinit && compinit to load the completions.

<!-- gh-comment-id:1255890332 --> @OrangeFran commented on GitHub (Sep 23, 2022): Try adding the completions output to a location in your `$fpath`. And the use `autoload -U compinit && compinit` to load the completions.
Author
Owner

@henderjm commented on GitHub (Dec 21, 2023):

just because it was also my first time consuming bash completions like this. I created a new folder in my home directory .bash_autocompletions/ and added it to my $fpath.

I then put the output into a file and most importantly name it the same as the executable and prefix it with an underscore! Don't be dumb and call it spotify-tui

mkdir ~/.bash_autocompletions.d
spt --completions zsh > ~/.bash_autocompletions/_spt

add to your bash dotfile in my case .zshrc

fpath=(~/.bash_completion.d/ $fpath)
autoload -U compinit && compinit

refresh and you should see it working as expected.

<!-- gh-comment-id:1866419432 --> @henderjm commented on GitHub (Dec 21, 2023): just because it was also my first time consuming bash completions like this. I created a new folder in my home directory .bash_autocompletions/ and added it to my $fpath. I then put the output into a file and most importantly name it the same as the executable and prefix it with an underscore! Don't be dumb and call it spotify-tui ```sh mkdir ~/.bash_autocompletions.d spt --completions zsh > ~/.bash_autocompletions/_spt ``` add to your bash dotfile in my case .zshrc ``` fpath=(~/.bash_completion.d/ $fpath) autoload -U compinit && compinit ``` refresh and you should see it working as expected.
Author
Owner

@chrisgrieser commented on GitHub (Dec 21, 2023):

Right, that was actually it, forgot to close the issue afterwards.

<!-- gh-comment-id:1866438939 --> @chrisgrieser commented on GitHub (Dec 21, 2023): Right, that was actually it, forgot to close the issue afterwards.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/spotify-tui#447
No description provided.