kopia lustrzana https://github.com/espressif/esp-idf
Merge branch 'bugxif/fix-export-autocomplete-zsh' into 'master'
export.sh: Fix error when `ZSH_VERSION` is unset. Closes IDFGH-4784 See merge request espressif/esp-idf!12545pull/6718/head
commit
dadce650c9
11
export.sh
11
export.sh
|
@ -17,7 +17,7 @@ idf_export_main() {
|
||||||
# Doing this in case someone tries to chmod +x it and execute...
|
# Doing this in case someone tries to chmod +x it and execute...
|
||||||
|
|
||||||
# shellcheck disable=SC2128,SC2169,SC2039 # ignore array expansion warning
|
# shellcheck disable=SC2128,SC2169,SC2039 # ignore array expansion warning
|
||||||
if [ -n "${BASH_SOURCE}" ] && [ "${BASH_SOURCE[0]}" = "${0}" ]
|
if [ -n "${BASH_SOURCE-}" ] && [ "${BASH_SOURCE[0]}" = "${0}" ]
|
||||||
then
|
then
|
||||||
echo "This script should be sourced, not executed:"
|
echo "This script should be sourced, not executed:"
|
||||||
# shellcheck disable=SC2039 # reachable only with bash
|
# shellcheck disable=SC2039 # reachable only with bash
|
||||||
|
@ -32,10 +32,10 @@ idf_export_main() {
|
||||||
self_path=""
|
self_path=""
|
||||||
|
|
||||||
# shellcheck disable=SC2128 # ignore array expansion warning
|
# shellcheck disable=SC2128 # ignore array expansion warning
|
||||||
if [ -n "${BASH_SOURCE}" ]
|
if [ -n "${BASH_SOURCE-}" ]
|
||||||
then
|
then
|
||||||
self_path="${BASH_SOURCE}"
|
self_path="${BASH_SOURCE}"
|
||||||
elif [ -n "${ZSH_VERSION}" ]
|
elif [ -n "${ZSH_VERSION-}" ]
|
||||||
then
|
then
|
||||||
self_path="${(%):-%x}"
|
self_path="${(%):-%x}"
|
||||||
else
|
else
|
||||||
|
@ -141,11 +141,12 @@ idf_export_main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
enable_autocomplete() {
|
enable_autocomplete() {
|
||||||
if [ -n "$ZSH_VERSION" ]
|
if [ -n "${ZSH_VERSION-}" ]
|
||||||
then
|
then
|
||||||
autoload -Uz compinit && compinit -u
|
autoload -Uz compinit && compinit -u
|
||||||
eval "$(env _IDF.PY_COMPLETE=source_zsh idf.py)" || echo "WARNING: Failed to load shell autocompletion!"
|
eval "$(env _IDF.PY_COMPLETE=source_zsh idf.py)" || echo "WARNING: Failed to load shell autocompletion!"
|
||||||
else
|
elif [ -n "${BASH_SOURCE-}" ]
|
||||||
|
then
|
||||||
eval "$(env _IDF.PY_COMPLETE=source_bash idf.py)" || echo "WARNING: Failed to load shell autocompletion!"
|
eval "$(env _IDF.PY_COMPLETE=source_bash idf.py)" || echo "WARNING: Failed to load shell autocompletion!"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue