etc: make the new bash-completion file work for all variants of our executables.

In particular make it also work with the `gimp-console` and with all
symlink names.

Also rename the bash completion file using the full application version
so that it will be possible to install several such completion files
side by side.
This commit is contained in:
Jehan 2025-05-09 23:35:29 +02:00 committed by Bruno
parent c55cfc9fa1
commit 24a69df9ab
2 changed files with 30 additions and 6 deletions

View file

@ -1,4 +1,3 @@
__gimp()
{
COMPREPLY=()
@ -73,4 +72,19 @@ __gimp()
return 0
}
complete -F __gimp gimp
complete -F __gimp @GIMP_MAIN_EXE@
if command -v @GIMP_SYMLINK1@ 2>&1 > /dev/null
then
complete -F __gimp @GIMP_SYMLINK1@
complete -F __gimp @GIMP_SYMLINK2@
fi
if command -v @GIMP_CONSOLE_EXE@ 2>&1 > /dev/null
then
complete -F __gimp @GIMP_CONSOLE_EXE@
if command -v @GIMP_CONSOLE_SYMLINK1@ 2>&1 > /dev/null
then
complete -F __gimp @GIMP_CONSOLE_SYMLINK1@
complete -F __gimp @GIMP_CONSOLE_SYMLINK2@
fi
fi

View file

@ -36,8 +36,18 @@ if have_bash
bash_comp_inst_dir = get_option('datadir') / 'bash-completion' / 'completions'
endif
install_data('bash_completion',
install_dir: bash_comp_inst_dir,
rename: 'gimp',
)
bash_completion_conf = configuration_data()
bash_completion_conf.set('GIMP_MAIN_EXE', gimpmain_exe_name)
bash_completion_conf.set('GIMP_SYMLINK1', 'gimp-' + gimp_app_version_major.to_string())
bash_completion_conf.set('GIMP_SYMLINK2', 'gimp')
bash_completion_conf.set('GIMP_CONSOLE_EXE', gimpconsole_exe_name)
bash_completion_conf.set('GIMP_CONSOLE_SYMLINK1', 'gimp-console-' + gimp_app_version_major.to_string())
bash_completion_conf.set('GIMP_CONSOLE_SYMLINK2', 'gimp-console')
configure_file(input : 'bash_completion.in',
output: 'gimp-' + gimp_app_version,
configuration: bash_completion_conf,
install: true,
install_dir: bash_comp_inst_dir)
endif