MusicPlayerDaemon / mpc

Command-line client for MPD
GNU General Public License v2.0
191 stars 36 forks source link

mpc-completion doesn't work properly if a user defines `$MPC_FORMAT` #94

Closed unera closed 8 months ago

unera commented 1 year ago

manpage: MPC_FORMAT Configure the format used to display songs. See option --format.

for example, I want to see the filename when I do mpc status (or mpc) in a console, so I define in my zshrc the following line:

export MPC_FORMAT='%artist% - %title% ( "%file%" )'

Since then, I have found that completions for mpc add etc are thoroughly broken.

MaxKellermann commented 1 year ago

The completion code has been written by many drive-by contributors, but there is no maintainer. If you want this fixed, submit a PR.

MaxKellermann commented 1 year ago

Half a year later, nobody was interested in fixing this bug. If this issue continues to exist, the completion scripts will be deleted.

izmyname commented 12 months ago

Alternative solution might be removing MPC_FORMAT variable and implementing a config file, where default format output for commands like 'mpc playlist' could be specified.

izmyname commented 12 months ago

UPD: There's a hacky solution - add alias mpc ="mpc -f %position%... etc" in .zshrc. It applies formatting to all mpc commands but does not break completions.

MaxKellermann commented 12 months ago

That's not a hacky solution - it's a solution. If you expect mpc to print a certain format, specify it explicitly instead of assuming that mpc uses its defaults. Do you want to submit a PR?

izmyname commented 12 months ago

I don't know what exactly I should submit since I didn't change anything in mpc. What I did is:

unset MPC_FORMAT

~/.zshrc

#Use this instead setting $MPC_FORMAT becsuse the latter breaks completions
alias mpc="mpc -f '%position%. %Artist% %performer% - %title% (%Album% %date%)'"

source .zshrc

done

MaxKellermann commented 12 months ago

Oh, that you mean. I thought you had added -f to the bash completion script. Because that would be the solution.

izmyname commented 8 months ago

Unfortunately, the problem still persists for me with ZSH. Compinit is still broken. Falling back to using alias.