Skip to content

Commit 657fcf6

Browse files
committed
*: Use [:blank:] instead of $'\t ' tricks where appropriate, fixes #19
1 parent eae0183 commit 657fcf6

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

bash_completion

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ __reassemble_comp_words_by_ref()
260260
# Is word separator not preceded by whitespace in original line
261261
# and are we not going to append to word 0 (the command
262262
# itself), then append to current word.
263-
[[ $line != [$' \t']* ]] && (( j >= 2 )) && ((j--))
263+
[[ $line != [[:blank:]]* ]] && (( j >= 2 )) && ((j--))
264264
# Append word separator to current or new word
265265
ref="$2[$j]"
266266
printf -v "$ref" %s "${!ref}${COMP_WORDS[i]}"
@@ -270,7 +270,7 @@ __reassemble_comp_words_by_ref()
270270
line=${line#*"${COMP_WORDS[$i]}"}
271271
# Start new word if word separator in original line is
272272
# followed by whitespace.
273-
[[ $line == [$' \t']* ]] && ((j++))
273+
[[ $line == [[:blank:]]* ]] && ((j++))
274274
# Indicate next word if available, else end *both* while and
275275
# for loop
276276
(( $i < ${#COMP_WORDS[@]} - 1)) && ((i++)) || break 2
@@ -781,7 +781,7 @@ _parse_help()
781781
esac } \
782782
| while read -r line; do
783783
784-
[[ $line == *([ $'\t'])-* ]] || continue
784+
[[ $line == *([[:blank:]])-* ]] || continue
785785
# transform "-f FOO, --foo=FOO" to "-f , --foo=FOO" etc
786786
while [[ $line =~ \
787787
((^|[^-])-[A-Za-z0-9?][[:space:]]+)\[?[A-Z0-9]+\]? ]]; do
@@ -1567,7 +1567,7 @@ _known_hosts_real()
15671567

15681568
# append any available aliases from config files
15691569
if [[ ${#config[@]} -gt 0 && -n "$aliases" ]]; then
1570-
local hosts=$( command sed -ne 's/^['"$'\t '"']*[Hh][Oo][Ss][Tt]['"$'\t '"']\{1,\}\([^#*?%]*\)\(#.*\)\{0,1\}$/\1/p' "${config[@]}" )
1570+
local hosts=$( command sed -ne 's/^[[:blank:]]*[Hh][Oo][Ss][Tt][[:blank:]]\{1,\}\([^#*?%]*\)\(#.*\)\{0,1\}$/\1/p' "${config[@]}" )
15711571
COMPREPLY+=( $( compgen -P "$prefix$user" \
15721572
-S "$suffix" -W "$hosts" -- "$cur" ) )
15731573
fi

completions/dict

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
_dictdata()
44
{
55
dict $host $port $1 2>/dev/null | command sed -ne \
6-
's/^['$'\t '']\{1,\}\([^ '$'\t'']*\).*$/\1/p'
6+
's/^[[:blank:]]\{1,\}\([^[:blank:]]*\).*$/\1/p'
77
}
88

99
_dict()

completions/kldunload

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ _kldunload()
77
local cur prev words cword
88
_init_completion || return
99

10-
COMPREPLY=( $( kldstat | \
11-
command sed -ne "s/^.*[ $'\t']\{1,\}\($cur[a-z_]\{1,\}\).ko$/\1/p" ) )
10+
COMPREPLY=( $( kldstat | command sed -ne \
11+
"s/^.*[[:blank:]]\{1,\}\($cur[a-z_]\{1,\}\).ko$/\1/p" ) )
1212
} &&
1313
complete -F _kldunload kldunload
1414

completions/mount

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ _mount()
4242
if [[ -n $host ]]; then
4343
COMPREPLY=( $( compgen -P "//$host" -W \
4444
"$( smbclient -d 0 -NL $host 2>/dev/null |
45-
command sed -ne '/^['"$'\t '"']*Sharename/,/^$/p' |
46-
command sed -ne '3,$s|^[^A-Za-z]*\([^'"$'\t '"']*\).*$|/\1|p' )" \
45+
command sed -ne '/^[[:blank:]]*Sharename/,/^$/p' |
46+
command sed -ne '3,$s|^[^A-Za-z]*\([^[:blank:]]*\).*$|/\1|p' )" \
4747
-- "${cur#//$host}" ) )
4848
fi
4949
elif [[ -r /etc/vfstab ]]; then

completions/mount.linux

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,8 @@ _mount()
232232
if [[ -n $host ]]; then
233233
COMPREPLY=( $( compgen -P "//$host" -W \
234234
"$( smbclient -d 0 -NL $host 2>/dev/null |
235-
command sed -ne '/^['"$'\t '"']*Sharename/,/^$/p' |
236-
command sed -ne '3,$s|^[^A-Za-z]*\([^'"$'\t '"']*\).*$|/\1|p' )" \
235+
command sed -ne '/^[[:blank:]]*Sharename/,/^$/p' |
236+
command sed -ne '3,$s|^[^A-Za-z]*\([^[:blank:]]*\).*$|/\1|p' )" \
237237
-- "${cur#//$host}" ) )
238238
fi
239239
fi

completions/valgrind

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ _valgrind()
7070
# generic cases parsed from --help output
7171
--+([-A-Za-z0-9_]))
7272
local value=$( $1 --help-debug $tool 2>/dev/null | \
73-
command sed -ne "s|^[$' \t']*$prev=\([^$' \t']\{1,\}\).*|\1|p" )
73+
command sed -ne "s|^[[:blank:]]*$prev=\([^[:blank:]]\{1,\}\).*|\1|p" )
7474
case $value in
7575
\<file*\>)
7676
_filedir

0 commit comments

Comments
 (0)