Missing command line completion

Hi everyone,

I managed to compile the latest command line version of G’mic under linux and it works, but I don’t have the completion feature (you know, you press TAB and it finishes the word).

I tried : make bashcompletion

But it failed :
Makefile:687 : la recette pour la cible « bashcompletion » a échouée
make: *** [bashcompletion] Erreur 255

Any ideas for me ?

PS : I am not dead :blush:

1 Like

Good point!
The commit below fix this issue:

https://github.com/dtschump/gmic/commit/9277d3649d4c436f86b2d5d72a1e70b980612b19

Glad to have you alive! :wink:

1 Like

thank you David!

it works :
Bash completion script ‘gmic_bashcompletion.sh’ has been successfully generated in ‘…/resources/’.

Than I did :
source gmic/resources/gmic_bashcompletion.sh

But it doesn’t work properly, each time I press TAB it says:
_init_completion : commande introuvable

What am I doing wrong?

I don’t know. This works for me with the fix, without any issue.
I’m not sure how I can help here.

I have commented those 2 lines:
# _init_completion || return
and :
# _filedir

and it seems to work perfectly now, I don’t know why :face_with_raised_eyebrow:

Anyway, I am using Linux Mint 18 KDE, in case it can help someone else.

I’m curious : what is your bash version.
Apparently, this is a “common” issue that many projects encountered
(e.g. kubectl -bash: _init_completion: command not found · Issue #12400 · kubernetes/kubernetes · GitHub)

Does this work when installing

sudo apt install bash-completion

?

Yes, I had seen that post and a few others. My bash version is supposedly enough 4.? (can’t check precisely from work).

On the repository version of G’mic, the completion was already not there and for me, it has been like this for years.

And do you have the bash-completion package installed ? Just curious.
It seems installing this solves the problem.

bash --version
GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)

sudo apt install bash-completion
Lecture des listes de paquets… Fait
Construction de l’arbre des dépendances
Lecture des informations d’état… Fait
bash-completion est déjà la version la plus récente (1:2.1-4.2ubuntu1.1).
0 mis à jour, 0 nouvellement installés, 0 à enlever et 2 non mis à jour.

If I don’t specifically source gmic_bashcompletion.sh, the completion doesn’t work for G’mic.

@ZondeR, I’ve made a few changes to the bashcompletion script generator:

https://github.com/dtschump/gmic/commit/c6ca1872059f5a8619a1d4497607d615dcb66170

Here is the bashcompletion script that is now produced:
gmic_bashcompletion.sh (130.6 KB)

Could you test it and tell me if you still get the error messages about _init_completion and _filedir not defined ?
Thanks!

I don’t get the error message, but I don’t get the completion either.

:sob:

Any idea how to modify the current bash completion script to make it work for you ?
As I can’t reproduce the issue here, it’s really hard for me to fix it.

Well, with 2 lines commented like said earlier, it works:

It is almost perfect, it just keep the color modification for my shell. So if the G’mic message finishes in green, what I am going to type in my shell then is green.

It is quite ok for me like this.

By the way, if there are MacOS gmic cli users interested in completion.

Since some time Apple recommends or switches automatically to zsh, not to bash.
Under zsh the (bash) completion for gmic cli works too! You have to add some lines in the zsh configuration file, often .zshrc:

autoload -Uz compinit && compinit
autoload -Uz bashcompinit && bashcompinit
source <file path to gmic source>/gmic/resources/gmic_bashcompletion.sh