Skip to content

Commit

Permalink
refactor: clean up old IFS/noglob handling
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed May 3, 2023
1 parent f651c9d commit 878d7db
Show file tree
Hide file tree
Showing 9 changed files with 0 additions and 18 deletions.
8 changes: 0 additions & 8 deletions completions/7z
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@ _comp_cmd_7z()
COMPREPLY=($(compgen -P"$opt" -W '@ ! r@ r-@ r0@ r! r-! r0!' \
-- "$cur"))
elif [[ $cur == ?(r@(-|0|))@* ]]; then
local IFS=$' \t\n' reset=$(shopt -po noglob)
set -o noglob
_comp_compgen -c "${cur#*@}" -- -P"${opt}${cur%%@*}@" -f
$reset
compopt -o filenames
fi
return
Expand All @@ -46,13 +43,8 @@ _comp_cmd_7z()
return
;;
-o* | -w?*)
local reset=$(shopt -po noglob)
set -o noglob
compopt -o filenames
local IFS=$'\n'
_comp_compgen -c "${cur:2}" -- -d -P"${cur:0:2}" -S/
_comp_unlocal IFS
$reset
compopt -o nospace
return
;;
Expand Down
1 change: 0 additions & 1 deletion completions/_su
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ _comp_cmd_su()
return
;;
-c | --command | --session-command)
local IFS=$'\n'
compopt -o filenames
_comp_compgen -- -d -c
return
Expand Down
2 changes: 0 additions & 2 deletions completions/_umount.linux
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ _comp_cmd_umount__reply_compgen_array()
ecur=${ecur//\'/\\\'}

# Actually generate completions.
local IFS=$'\n'
_comp_compgen -c "${ecur}" -- -W "$wlist"
_comp_unlocal IFS
}

# Unescape strings in the linux fstab(5) format (with octal escapes).
Expand Down
1 change: 0 additions & 1 deletion completions/help
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ _comp_cmd_help()
return
fi

local IFS=$'\t\n'
_comp_compgen -- -A helptopic
((${#COMPREPLY[*]} != 1)) || printf -v "COMPREPLY[0]" %q "$COMPREPLY"
} &&
Expand Down
1 change: 0 additions & 1 deletion completions/hunspell
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ _comp_cmd_hunspell()
if ((${#dicts[@]})); then
dicts=("${dicts[@]##*/}")
dicts=("${dicts[@]%.dic}")
local IFS=$'\n'
_comp_compgen -- -W '"${dicts[@]}"'
fi
return
Expand Down
1 change: 0 additions & 1 deletion completions/mysql
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ _comp_xfunc_mysql_character_sets()
charsets+=(utf8)
charsets=("${charsets[@]##*/}")
charsets=("${charsets[@]%.xml}")
local IFS=$'\n'
_comp_compgen -a -- -W '"${charsets[@]}"' -X ''
}

Expand Down
2 changes: 0 additions & 2 deletions completions/perl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ _comp_cmd_perl()
return
;;
-*[Ix])
local IFS=$'\n'
compopt -o filenames
_comp_compgen -- -d "$optPrefix" $optSuffix
return
Expand Down Expand Up @@ -78,7 +77,6 @@ _comp_cmd_perl()
# Likewise, `-I' also accepts a space between option and argument
# and it takes a directory as value.
elif [[ $prev == -I ]]; then
local IFS=$'\n'
compopt -o filenames
# shellcheck disable=SC2086
_comp_compgen -- -d ${optPrefix-} ${optSuffix-}
Expand Down
1 change: 0 additions & 1 deletion completions/vpnc
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ _vpnc()
if ((${#configs[@]})); then
configs=("${configs[@]##*/}")
configs=("${configs[@]%.conf}")
local IFS=$'\n'
compopt -o filenames
_comp_compgen -- -W '"${configs[@]}"'
fi
Expand Down
1 change: 0 additions & 1 deletion completions/xdg-mime
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ _comp_cmd_xdg_mime()
_comp_expand_glob desktops '/usr/share/applications/*.desktop'
if ((${#desktops[@]})); then
desktops=("${desktops[@]##*/}")
local IFS=$'\n'
_comp_compgen -- -W '"${desktops[@]}"'
fi
else
Expand Down

0 comments on commit 878d7db

Please sign in to comment.