You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(completions/*): avoid [[ -v var ]] for localvar_inherit
When the assigned values are ensured to be non-empty strings, [[ -v
var ]] is converted to [[ $var ]]. Otherwise, another local variable
`has_var` is added to manage the assigned state, and [[ -v var ]] is
converted to [[ $has_var ]]. I here did not consider whether the
empty value of $var actually makes a sense or not.
Copy file name to clipboardExpand all lines: completions/apt-mark
+2-3Lines changed: 2 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -5,16 +5,15 @@ _comp_cmd_apt_mark()
5
5
local cur prev words cword split comp_args
6
6
_comp_initialize -s -- "$@"||return
7
7
8
-
local special i
9
-
unset -v special # workaround for localvar_inherit
8
+
local special="" i
10
9
for((i =1; i <${#words[@]}-1; i++));do
11
10
if [[ ${words[i]}==@(auto|manual|minimize-manual|showauto|showmanual|hold|unhold|showhold|install|remove|deinstall|purge|showinstall|showremove|showpurge) ]];then
12
11
special=${words[i]}
13
12
break
14
13
fi
15
14
done
16
15
17
-
if [[ -v special ]];then
16
+
if [[ $special ]];then
18
17
case$specialin
19
18
auto | manual | unhold)
20
19
local -A showcmds=([auto]=manual [manual]=auto [unhold]=hold)
Copy file name to clipboardExpand all lines: completions/aptitude
+2-3Lines changed: 2 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -18,16 +18,15 @@ _aptitude()
18
18
local cur prev words cword comp_args
19
19
_comp_initialize -- "$@"||return
20
20
21
-
local special i
22
-
unset -v special # workaround for localvar_inherit
21
+
local special="" i
23
22
for((i =1; i <${#words[@]}-1; i++));do
24
23
if [[ ${words[i]}==@(@(|re)install|@(|un)hold|@(|un)markauto|@(dist|full|safe)-upgrade|download|show|forbid-version|purge|remove|changelog|why@(|-not)|keep@(|-all)|build-dep|@(add|remove)-user-tag|versions) ]];then
0 commit comments