Skip to content

Commit 28c3247

Browse files
akinomyogascop
authored andcommitted
refactor: normalize unset positions of call-once functions
* bash_completion (_comp_dequote__initialize): The initialization function "_comp_dequote__initialize" has been unset itself at the beginning, but other similar call-once functions unset themselves at the end of the functions. We make "_comp_dequote__initialize" unset itself at the end for consistency with the other call-once functions. * completions/vncviewer (_comp_cmd_vncviewer__bootstrap): This function wants to return the exit status of the dispatched function, so we unset the function just before the processing of the dispatched function, following an existing function "_comp_cmd_makepkg__bootstrap".
1 parent 5d5ccb3 commit 28c3247

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

bash_completion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,10 @@ _comp_quote()
180180
# shellcheck disable=SC1003
181181
_comp_dequote__initialize()
182182
{
183-
unset -f "$FUNCNAME"
184183
local regex_param='\$([_a-zA-Z][_a-zA-Z0-9]*|[-*@#?$!0-9_])|\$\{[!#]?([_a-zA-Z][_a-zA-Z0-9]*(\[([0-9]+|[*@])\])?|[-*@#?$!0-9_])\}'
185184
local regex_quoted='\\.|'\''[^'\'']*'\''|\$?"([^\"$`!]|'$regex_param'|\\.)*"|\$'\''([^\'\'']|\\.)*'\'''
186185
_comp_dequote__regex_safe_word='^([^\'\''"$`;&|<>()!]|'$regex_quoted'|'$regex_param')*$'
186+
unset -f "$FUNCNAME"
187187
}
188188
_comp_dequote__initialize
189189

completions/vncviewer

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ _comp_cmd_vncviewer__bootstrap()
1111
esac
1212

1313
# Install real completion for subsequent completions
14+
unset -f "$FUNCNAME"
1415
complete -F $fname vncviewer
1516
$fname "$@" # Generate completions once for now
16-
unset -f "$FUNCNAME"
1717
} &&
1818
complete -F _comp_cmd_vncviewer__bootstrap vncviewer
1919

0 commit comments

Comments
 (0)