Merge pull request #11240 from 0x5a4/fix-11208

fix: bash mangles flake ref completion
This commit is contained in:
tomberek 2024-08-19 10:46:27 -04:00 committed by GitHub
commit b0a7edb5ab
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -12,9 +12,16 @@ function _complete_nix {
elif [[ $completion == attrs ]]; then elif [[ $completion == attrs ]]; then
compopt -o nospace compopt -o nospace
fi fi
else continue
COMPREPLY+=("$completion")
fi fi
if [[ "${cur}" =~ "=" ]]; then
# drop everything up to the first =. if a = is included, bash assumes this to be
# an arg=value argument and the completion gets mangled (see #11208)
completion="${completion#*=}"
fi
COMPREPLY+=("${completion}")
done < <(NIX_GET_COMPLETIONS=$cword "${words[@]}" 2>/dev/null) done < <(NIX_GET_COMPLETIONS=$cword "${words[@]}" 2>/dev/null)
__ltrim_colon_completions "$cur" __ltrim_colon_completions "$cur"
} }