Skip to content

bash-completions-getter.sh: line 178: _completion_loader: command not found #5

@wentasah

Description

@wentasah

I'm trying to make this work on NixOS and I'm getting the following error:

/nix/store/0ibqj2ysg8602by5azn2rgm64w6gmsnd-source/bash-completions-getter.sh: line 178: _completion_loader: command not found

It seems that when bash is run in non-interactive mode, this function is not defined on NixOS. I can resolve the issue with the following change, but I'm not sure how generic it is and whether it would work on other distributions.

diff --git a/zsh-bash-completions-fallback.plugin.zsh b/zsh-bash-completions-fallback.plugin.zsh
index 61402cb..4609ff9 100644
--- a/zsh-bash-completions-fallback.plugin.zsh
+++ b/zsh-bash-completions-fallback.plugin.zsh
@@ -12,7 +12,7 @@ function _bash_completions_fallback_completer {
         ZSH_WORDBREAKS="$WORDCHARS" \
         ZSH_WORDS="${words[@]}" \
         ZSH_CURRENT=$((CURRENT-1)) \
-        bash -c \
+        bash -i -c \
         "source ${_bash_completions_getter_path}; get_completions")}");
 
     local -a -U bopts=("${(ps: :)${(@f)out:0:1}}");
@@ -83,7 +83,7 @@ function _bash_completions_fetch_supported_commands {
 
     if [ -n "${ZSH_BASH_COMPLETIONS_FALLBACK_LOAD_NATIVE_COMPLETIONS-:true}" ]; then
         local out=("${(u@f)$( \
-            bash -c \
+            bash -i -c \
             "source ${_bash_completions_getter_path}; get_defined_completions")}");
         _bash_completions_commands+=($out)
     fi

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions