Skip to content

Commit 9472e8c

Browse files
committed
refactor(_known_hosts_real,tar,upgradepkg): use "set" as positive flag
1 parent 24227bf commit 9472e8c

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

bash_completion

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1960,7 +1960,10 @@ _known_hosts_real()
19601960
local OPTIND=1
19611961
while getopts "ac46F:p:" flag "$@"; do
19621962
case $flag in
1963-
a) aliases='yes' ;;
1963+
a)
1964+
# shellcheck disable=SC2209
1965+
aliases=set
1966+
;;
19641967
c) suffix=':' ;;
19651968
F)
19661969
if [[ ! $OPTARG ]]; then
@@ -1970,8 +1973,14 @@ _known_hosts_real()
19701973
configfile=$OPTARG
19711974
;;
19721975
p) prefix=$OPTARG ;;
1973-
4) ipv4=1 ;;
1974-
6) ipv6=1 ;;
1976+
4)
1977+
# shellcheck disable=SC2209
1978+
ipv4=set
1979+
;;
1980+
6)
1981+
# shellcheck disable=SC2209
1982+
ipv6=set
1983+
;;
19751984
*)
19761985
echo "bash_completion: $FUNCNAME: usage error" >&2
19771986
return 1

completions/tar

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,8 @@ __tar_posix_prev_handle()
675675

676676
_posix_tar()
677677
{
678-
local long_opts short_opts basic_tar="" \
678+
# shellcheck disable=SC2209
679+
local long_opts short_opts basic_tar=set \
679680
long_arg_none="" long_arg_opt long_arg_req="" \
680681
short_arg_none short_arg_opt short_arg_req \
681682
tar_mode tar_mode_arg old_opt_progress=0 \
@@ -691,7 +692,6 @@ _posix_tar()
691692

692693
_comp_initialize -s -- "$@" || return
693694

694-
basic_tar=yes
695695
tar_mode=none
696696

697697
# relatively compatible modes are {c,t,x}

completions/upgradepkg

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ _upgradepkg()
1717
local nofiles="" IFS=$'\n'
1818
compopt -o filenames
1919
COMPREPLY=($(compgen -P "$prev%" -f -X "!*.@(t[bgxl]z)" -- "$cur"))
20-
[[ ${COMPREPLY-} ]] || nofiles=1
20+
# shellcheck disable=SC2209
21+
[[ ${COMPREPLY-} ]] || nofiles=set
2122
COMPREPLY+=($(compgen -P "$prev%" -S '/' -d -- "$cur"))
2223
[[ $nofiles ]] && compopt -o nospace
2324
return

0 commit comments

Comments
 (0)