CMake --workflow completion not working

I often build CMake projects on my Manjaro system and until a while ago I could type the following in a bash terminal:
cmake --bu
then press Tab which would autocomplete to --build. It would do the same for most of the CMake --workflows, e.g. --install and similar. Since I am often testing build procedures in VMs with other distros I have seen the same working on clean Ubuntu and Fedora installations out of the box (as long as the relevant CMake packages are installed).
A while ago this has stopped working in Manjaro. I have double-checked if this might be caused by my customized .bashrc, but creating a new profile/user with no modifications in .bashrc shows that it is not caused by that.
The actual completion mechanism is handled by the file /usr/share/bash-completion/completions/cmake which is installed and for whatever reason is not used…
How do I enable this on Manjaro?

Are you certain that bash-completion is actually installed?

I notice this thread that seems to indicate it might not be by default.

1 Like

Hi @grmpf,

Which shell are you using? Check with:

echo $0

If it’s not bash, you could try entering bash:

bash

…and see if it works there.

if it works and you want top keep bash, just change the shell:

chsh -s /usr/bin/bash $USER

That will provide the details of the environment’s shell.

If @grmpf is running their cmake --bu command from a terminal (probably Konsole as their profile says they are on Plasma), then they could actually be using zsh.

echo $0 will show what shell the terminal is using.

This is the different output of the 2 commands when run in a Konsole terminal (which defaults to zsh) on my Plasma system:

echo $SHELL 
/bin/bash
echo $0 
/bin/zsh

If their shell is running zsh, they can enter bash at the prompt to open a bash session:

    ~  bash   
[scotty@scott-ser ~]$ echo $0
bash
1 Like

Good point. Thank you!

Edit:

Fixed my instructions just now.

1 Like

Now this is embarrassing. Thanks, this is the solution. The bash-completion package was missing after a reinstall earlier this year.

3 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.