From 1e71b4ddc6570b2bdec078ca6e5fcc744d5ac270 Mon Sep 17 00:00:00 2001 From: Michael Tautschnig Date: Sun, 9 Feb 2025 12:15:59 +0100 Subject: [PATCH] Fix filename completion in bash autocompletion Bash globbing does not support `|` for alternatives, which meant that the prior pattern would only match file names that contained a `|`. --- scripts/bash-autocomplete/cbmc.sh.template | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/bash-autocomplete/cbmc.sh.template b/scripts/bash-autocomplete/cbmc.sh.template index e616902c26e..60e003543e7 100644 --- a/scripts/bash-autocomplete/cbmc.sh.template +++ b/scripts/bash-autocomplete/cbmc.sh.template @@ -54,6 +54,16 @@ _cbmc_autocomplete() fi #if none of the above applies, offer directories and files that we can analyze - COMPREPLY=( $(compgen -G '*.class|*.jar|*.cpp|*.cc|*.c\+\+|*.ii|*.cxx|*.c|*.i|*.gb' -- $cur) ) + _filedir -d + COMPREPLY+=( $(compgen -G "$cur*.c") ) + COMPREPLY+=( $(compgen -G "$cur*.c\+\+") ) + COMPREPLY+=( $(compgen -G "$cur*.cc") ) + COMPREPLY+=( $(compgen -G "$cur*.class") ) + COMPREPLY+=( $(compgen -G "$cur*.cpp") ) + COMPREPLY+=( $(compgen -G "$cur*.cxx") ) + COMPREPLY+=( $(compgen -G "$cur*.gb") ) + COMPREPLY+=( $(compgen -G "$cur*.i") ) + COMPREPLY+=( $(compgen -G "$cur*.ii") ) + COMPREPLY+=( $(compgen -G "$cur*.jar") ) } complete -F _cbmc_autocomplete cbmc