Skip to content

Commit 3f4579c

Browse files
committed
refactor(make,mutt,strace): use "set" for flag table
1 parent f85a840 commit 3f4579c

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

completions/make

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,12 @@ _comp_make__truncate_non_unique_paths()
110110
local target
111111
for target in "${COMPREPLY[@]}"; do
112112
local path=${target%/}
113-
while [[ ! ${paths[$path]+set} ]] &&
114-
paths[$path]=1 &&
115-
[[ $path == "$prefix"*/* ]]; do
113+
while
114+
# shellcheck disable=SC2209
115+
[[ ! ${paths[$path]+set} ]] &&
116+
paths[$path]=set &&
117+
[[ $path == "$prefix"*/* ]]
118+
do
116119
path=${path%/*}
117120
nchild[$path]=$((${nchild[$path]-0} + 1))
118121
done

completions/mutt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,9 @@ _comp_cmd_mutt__get_conffiles()
6464
# @var[ref] visited Dictionary of config files already visited
6565
_comp_cmd_mutt__get_conffiles__visit()
6666
{
67-
[[ -f $1 && ${visited[$1]-} != yes ]] || return 0
68-
visited[$1]=yes
67+
[[ -f $1 && ${visited[$1]-} != set ]] || return 0
68+
# shellcheck disable=SC2209
69+
visited[$1]=set
6970
conffiles+=("$1")
7071

7172
local -a newconffiles=($(command sed -n 's|^source[[:space:]]\{1,\}\([^[:space:]]\{1,\}\).*$|\1|p' "$1"))

completions/strace

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,10 @@ _strace()
3838
local define syscall rest
3939
local -A syscalls
4040
while read -r define syscall rest; do
41+
# shellcheck disable=SC2209
4142
[[ $define == "#define" &&
4243
$syscall =~ ^__NR_(.+) ]] &&
43-
syscalls[${BASH_REMATCH[1]}]=1
44+
syscalls[${BASH_REMATCH[1]}]=set
4445
done 2>/dev/null </usr/include/asm/unistd.h
4546
if ((${#syscalls[@]} == 0)); then
4647
local unistd arch=$(command uname -m)
@@ -50,9 +51,10 @@ _strace()
5051
unistd=/usr/include/asm/unistd_64.h
5152
fi
5253
while read -r define syscall rest; do
54+
# shellcheck disable=SC2209
5355
[[ $define == "#define" &&
5456
$syscall =~ ^__NR_(.+) ]] &&
55-
syscalls[${BASH_REMATCH[1]}]=1
57+
syscalls[${BASH_REMATCH[1]}]=set
5658
done 2>/dev/null <$unistd
5759
fi
5860

0 commit comments

Comments
 (0)