mwh/dragon

Bash auto completions only show directory names

Closed this issue · 2 comments

In Ubuntu 22.04 with i3wm after compiling and installing the binary in the default location I get completions only for directories, that is, if I press after dragon<Space> in the shell, only directories are auto completed.

I solved this issue by using a custom completion command for dragon:

complete -o default -o bashdefault dragon

Can this behavior be implemented by default?

dragon doesn't do anything for shells to provide auto completion and I honestly don't see why it would need to. Perhaps you should configure your shell (like you seemingly did already) to suggest file paths as well. My zsh by default completes paths to files as well as directories and so does my completely unconfigured bash, so I suspect a user config issue that caused this in the first place.

Hi, I found the culprit. Apparently Dragon is also the name of a media player and in /usr/share/bash-completion/bash_completion of Ubuntu 22.04 there is a line that defines completions for "dragon" filtering out everything but media files.

See the following:

Excerpt of /usr/share/bash-completion/bash_completion

_install_xspec '!*@(.@(mp?(e)g|MP?(E)G|wm[av]|WM[AV]|avi|AVI|asf|vob|VOB|bin|dat|divx|DIVX|vcd|ps|pes|fli|flv|FLV|fxm|FXM|viv|rm|ram|yuv|mov|MOV|qt|QT|web[am]|WEB[AM]|mp[234]|MP[234]|m?(p)4[av]|M?(P)4[AV]|mkv|MKV|og[agmvx]|OG[AGMVX]|t[ps]|T[PS]|m2t?(s)|M2T?(S)|mts|MTS|wav|WAV|flac|FLAC|asx|ASX|mng|MNG|srt|m[eo]d|M[EO]D|s[3t]m|S[3T]M|it|IT|xm|XM|iso|ISO)|+([0-9]).@(vdr|VDR))?(.@(crdownload|part))' kaffeine dragon totem

Redefining completions as I mentioned in the first comment solves the problem.

Thank you!