Skip to content

Commit 8d4e04f

Browse files
committed
refactor: use _comp_compgen_help for _parse_help || _parse_usage
1 parent fb25c53 commit 8d4e04f

23 files changed

+23
-69
lines changed

completions/_cal

+1-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ _comp_cmd_cal()
2424
esac
2525

2626
if [[ $cur == -* ]]; then
27-
COMPREPLY=($(
28-
compgen -W '$(_parse_help "$1" || _parse_usage "$1")' -- "$cur"
29-
))
27+
_comp_compgen_help "$1" || _comp_compgen_usage "$1"
3028
return
3129
fi
3230

completions/_chsh

+1-3
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ _comp_cmd_chsh()
3232
esac
3333

3434
if [[ $cur == -* ]]; then
35-
COMPREPLY=($(
36-
compgen -W '$(_parse_help "$1" || _parse_usage "$1")' -- "$cur"
37-
))
35+
_comp_compgen_help "$1" || _comp_compgen_usage "$1"
3836
else
3937
_allowed_users
4038
fi

completions/_dmesg

+1-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ _comp_cmd_dmesg()
2525
;;
2626
esac
2727

28-
COMPREPLY=($(
29-
compgen -W '$(_parse_help "$1" || _parse_usage "$1")' -- "$cur"
30-
))
28+
_comp_compgen_help "$1" || _comp_compgen_usage "$1"
3129
} &&
3230
complete -F _comp_cmd_dmesg dmesg
3331

completions/_hexdump

+1-3
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ _comp_cmd_hexdump()
1919
esac
2020

2121
if [[ $cur == -* ]]; then
22-
COMPREPLY=($(
23-
compgen -W '$(_parse_help "$1" || _parse_usage "$1")' -- "$cur"
24-
))
22+
_comp_compgen_help "$1" || _comp_compgen_usage "$1"
2523
return
2624
fi
2725

completions/arp

+1-3
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ _comp_cmd_arp()
2929
esac
3030

3131
if [[ $cur == -* ]]; then
32-
COMPREPLY=($(
33-
compgen -W '$(_parse_help "$1" || _parse_usage "$1")' -- "$cur"
34-
))
32+
_comp_compgen_help "$1" || _comp_compgen_usage "$1"
3533
return
3634
fi
3735

completions/chmod

+1-3
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ _comp_cmd_chmod()
2222

2323
# shellcheck disable=SC2053
2424
if [[ $cur == -* && $cur != $modearg ]]; then
25-
COMPREPLY=($(
26-
compgen -W '$(_parse_help "$1" || _parse_usage "$1")' -- "$cur"
27-
))
25+
_comp_compgen_help "$1" || _comp_compgen_usage "$1"
2826
[[ ${COMPREPLY-} == *= ]] && compopt -o nospace
2927
return
3028
fi

completions/grpck

+1-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ _comp_cmd_grpck()
1515
esac
1616

1717
if [[ $cur == -* ]]; then
18-
COMPREPLY=($(
19-
compgen -W '$(_parse_help "$1" || _parse_usage "$1")' -- "$cur"
20-
))
18+
_comp_compgen_help "$1" || _comp_compgen_usage "$1"
2119
return
2220
fi
2321

completions/hostname

+1-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ _comp_cmd_hostname()
1818
esac
1919

2020
[[ $cur == -* ]] &&
21-
COMPREPLY=($(
22-
compgen -W '$(_parse_help "$1" || _parse_usage "$1")' -- "$cur"
23-
))
21+
_comp_compgen_help "$1" || _comp_compgen_usage "$1"
2422
} &&
2523
complete -F _comp_cmd_hostname hostname
2624

completions/ifstat

+1-3
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,7 @@ _comp_cmd_ifstat()
5959
[[ $was_split ]] && return
6060

6161
if [[ $cur == -* ]]; then
62-
COMPREPLY=($(
63-
compgen -W '$(_parse_help "$1" || _parse_usage "$1")' -- "$cur"
64-
))
62+
_comp_compgen_help "$1" || _comp_compgen_usage "$1"
6563
[[ ${COMPREPLY-} == *= ]] && compopt -o nospace
6664
return
6765
fi

completions/make

+1-3
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,7 @@ _comp_cmd_make()
173173
[[ $was_split ]] && return
174174

175175
if [[ $cur == -* ]]; then
176-
COMPREPLY=($(
177-
compgen -W '$(_parse_help "$1" || _parse_usage "$1")' -- "$cur"
178-
))
176+
_comp_compgen_help "$1" || _comp_compgen_usage "$1"
179177
[[ ${COMPREPLY-} == *= ]] && compopt -o nospace
180178
elif [[ $cur == *=* ]]; then
181179
prev=${cur%%=*}

completions/man

+1-3
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ _comp_cmd_man()
4646
[[ $was_split ]] && return
4747

4848
if [[ $cur == -* ]]; then
49-
COMPREPLY=($(
50-
compgen -W '$(_parse_help "$1" -h || _parse_usage "$1")' -- "$cur"
51-
))
49+
_comp_compgen_help "$1" -h || _comp_compgen_usage "$1"
5250
[[ ${COMPREPLY-} == *= ]] && compopt -o nospace
5351
return
5452
fi

completions/modinfo

+1-3
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ _comp_cmd_modinfo()
2828
[[ $was_split ]] && return
2929

3030
if [[ $cur == -* ]]; then
31-
COMPREPLY=($(
32-
compgen -W '$(_parse_help "$1" || _parse_usage "$1")' -- "$cur"
33-
))
31+
_comp_compgen_help "$1" || _comp_compgen_usage "$1"
3432
[[ ${COMPREPLY-} == *= ]] && compopt -o nospace
3533
return
3634
fi

completions/ntpdate

+1-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ _comp_cmd_ntpdate()
2525
esac
2626

2727
if [[ $cur == -* ]]; then
28-
COMPREPLY=($(
29-
compgen -W '$(_parse_help "$1" -h || _parse_usage "$1")' -- "$cur"
30-
))
28+
_comp_compgen_help "$1" -h || _comp_compgen_usage "$1"
3129
else
3230
_known_hosts_real -- "$cur"
3331
fi

completions/passwd

+1-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ _comp_cmd_passwd()
1515
esac
1616

1717
if [[ $cur == -* ]]; then
18-
COMPREPLY=($(
19-
compgen -W '$(_parse_help "$1" || _parse_usage "$1")' -- "$cur"
20-
))
18+
_comp_compgen_help "$1" || _comp_compgen_usage "$1"
2119
return
2220
fi
2321

completions/ping

+1-3
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,7 @@ _comp_cmd_ping()
5858
esac
5959

6060
if [[ $cur == -* ]]; then
61-
COMPREPLY=($(
62-
compgen -W '$(_parse_help "$1" || _parse_usage "$1")' -- "$cur"
63-
))
61+
_comp_compgen_help "$1" || _comp_compgen_usage "$1"
6462
return
6563
fi
6664

completions/pwck

+1-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ _comp_cmd_pwck()
66
_comp_initialize -- "$@" || return
77

88
if [[ $cur == -* ]]; then
9-
COMPREPLY=($(
10-
compgen -W '$(_parse_help "$1" || _parse_usage "$1")' -- "$cur"
11-
))
9+
_comp_compgen_help "$1" || _comp_compgen_usage "$1"
1210
return
1311
fi
1412

completions/quota

+1-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ _comp_cmd_quota__user_or_group()
1818

1919
_comp_cmd_quota__parse_help()
2020
{
21-
COMPREPLY=($(
22-
compgen -W '$(_parse_help "$1" || _parse_usage "$1")' -- "$cur"
23-
))
21+
_comp_compgen_help "$1" || _comp_compgen_usage "$1"
2422
[[ ${COMPREPLY-} == *= ]] && compopt -o nospace
2523
}
2624

completions/sudo

+1-3
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,7 @@ _comp_cmd_sudo()
4545
[[ $was_split ]] && return
4646

4747
if [[ $cur == -* ]]; then
48-
COMPREPLY=($(
49-
compgen -W '$(_parse_help "$1" || _parse_usage "$1")' -- "$cur"
50-
))
48+
_comp_compgen_help "$1" || _comp_compgen_usage "$1"
5149
[[ ${COMPREPLY-} == *= ]] && compopt -o nospace
5250
return
5351
fi

completions/sysctl

+1-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ _comp_cmd_sysctl()
1818
esac
1919

2020
if [[ $cur == -* ]]; then
21-
COMPREPLY=($(
22-
compgen -W '$(_parse_help "$1" || _parse_usage "$1")' -- "$cur"
23-
))
21+
_comp_compgen_help "$1" || _comp_compgen_usage "$1"
2422
else
2523
local suffix=
2624
[[ $prev == -w ]] && suffix="="

completions/timeout

+1-3
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ _comp_cmd_timeout()
3232
[[ $was_split ]] && return
3333

3434
if [[ $cur == -* ]]; then
35-
COMPREPLY=($(
36-
compgen -W '$(_parse_help "$1" || _parse_usage "$1")' -- "$cur"
37-
))
35+
_comp_compgen_help "$1" || _comp_compgen_usage "$1"
3836
[[ ${COMPREPLY-} == *= ]] && compopt -o nospace
3937
fi
4038
} &&

completions/tracepath

+1-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ _comp_cmd_tracepath()
1212
esac
1313

1414
if [[ $cur == -* ]]; then
15-
COMPREPLY=($(
16-
compgen -W '$(_parse_help "$1" || _parse_usage "$1")' -- "$cur"
17-
))
15+
_comp_compgen_help "$1" || _comp_compgen_usage "$1"
1816
return
1917
fi
2018

completions/vipw

+1-3
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ _comp_cmd_vipw()
1717
;;
1818
esac
1919

20-
COMPREPLY=($(
21-
compgen -W '$(_parse_help "$1" || _parse_usage "$1")' -- "$cur"
22-
))
20+
_comp_compgen_help "$1" || _comp_compgen_usage "$1"
2321
} &&
2422
complete -F _comp_cmd_vipw vipw vigr
2523

completions/xmlwf

+1-3
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ _comp_cmd_xmlwf()
2121
esac
2222

2323
if [[ $cur == -* ]]; then
24-
COMPREPLY=($(
25-
compgen -W '$(_parse_help "$1" || _parse_usage "$1")' -- "$cur"
26-
))
24+
_comp_compgen_help "$1" || _comp_compgen_usage "$1"
2725
return
2826
fi
2927

0 commit comments

Comments
 (0)