diff --git a/etc/bash_completion b/etc/bash_completion.in similarity index 82% rename from etc/bash_completion rename to etc/bash_completion.in index ea09863978..eb27cc5bad 100644 --- a/etc/bash_completion +++ b/etc/bash_completion.in @@ -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 diff --git a/etc/meson.build b/etc/meson.build index 74cb342897..a1a0bd8538 100644 --- a/etc/meson.build +++ b/etc/meson.build @@ -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