Fix completions for "set -u"

This commit is contained in:
Koichi Murase 2021-07-05 04:51:52 +09:00
parent de187e874d
commit ff4265b6a2
2 changed files with 2 additions and 2 deletions

View file

@ -24,7 +24,7 @@ func writePreamble(buf io.StringWriter, name string) {
WriteStringAndCheck(buf, fmt.Sprintf(` WriteStringAndCheck(buf, fmt.Sprintf(`
__%[1]s_debug() __%[1]s_debug()
{ {
if [[ -n ${BASH_COMP_DEBUG_FILE} ]]; then if [[ -n ${BASH_COMP_DEBUG_FILE-} ]]; then
echo "$*" >> "${BASH_COMP_DEBUG_FILE}" echo "$*" >> "${BASH_COMP_DEBUG_FILE}"
fi fi
} }

View file

@ -81,7 +81,7 @@ func genZshComp(buf io.StringWriter, name string, includeDesc bool) {
__%[1]s_debug() __%[1]s_debug()
{ {
local file="$BASH_COMP_DEBUG_FILE" local file="${BASH_COMP_DEBUG_FILE-}"
if [[ -n ${file} ]]; then if [[ -n ${file} ]]; then
echo "$*" >> "${file}" echo "$*" >> "${file}"
fi fi