From 7920c9dbe46bd5ad0a92e78b744f00ffe8b14e76 Mon Sep 17 00:00:00 2001 From: Koichi Murase Date: Tue, 30 May 2023 17:49:19 +0900 Subject: [PATCH] feat(_comp_compgen_{filedir,set}): define exit status --- bash_completion | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bash_completion b/bash_completion index 6eeafb33406..9e9978cdfdd 100644 --- a/bash_completion +++ b/bash_completion @@ -665,12 +665,14 @@ _comp_compgen() # caller _comp_compgen, the words are appended to the existing elements of the # array instead of replacing the existing elements. This function ignores # ${cur-} or the prefix specified by `-v CUR`. +# @return 0 if at least one completion is generated, or 1 otherwise. # @since 2.12 _comp_compgen_set() { local _append=${_comp_compgen__append-} local _var=${_comp_compgen__var-COMPREPLY} eval -- "$_var${_append:++}=(\"\$@\")" + (($#)) } # Simply split the text and generate completions. This function should be used @@ -1004,6 +1006,7 @@ _comp_quote_compgen() # @param $1 If `-d', complete only on directories. Otherwise filter/pick only # completions with `.$1' and the uppercase version of it as file # extension. +# @return 0 if at least one completion is generated, or 1 otherwise. # # @since 2.12 _comp_compgen_filedir()