Skip to content

Commit e633b62

Browse files
committed
refactor: rename { => _comp_compgen}_shells
1 parent d8f5f32 commit e633b62

File tree

9 files changed

+21
-13
lines changed

9 files changed

+21
-13
lines changed

bash_completion

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2057,15 +2057,17 @@ _comp_compgen_selinux_users()
20572057
}
20582058

20592059
# This function completes on valid shells
2060-
#
20612060
# @param $1 chroot to search from
2062-
# TODO:API: rename per conventions
2063-
_shells()
2061+
#
2062+
# @since 2.12
2063+
_comp_compgen_shells()
20642064
{
2065-
local shell rest
2066-
while read -r shell rest; do
2067-
[[ $shell == /* && $shell == "$cur"* ]] && COMPREPLY+=("$shell")
2065+
local -a _shells=()
2066+
local _shell _rest
2067+
while read -r _shell _rest; do
2068+
[[ $_shell == /* ]] && _shells+=("$_shell")
20682069
done 2>/dev/null <"${1-}"/etc/shells
2070+
_comp_compgen -- -W '"${_shells[@]}"'
20692071
}
20702072

20712073
# This function completes on valid filesystem types

bash_completion.d/000_bash_completion_compat.bash

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,12 @@ _allowed_groups()
392392
_comp_compgen -c "${1:-$cur}" allowed_groups
393393
}
394394

395+
# @deprecated 2.12 Use `_comp_compgen -a shells`
396+
_shells()
397+
{
398+
_comp_compgen -a shells
399+
}
400+
395401
# @deprecated 2.12 Use `_comp_compgen -a fstypes`
396402
_fstypes()
397403
{

completions/_chsh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ _comp_cmd_chsh()
2626
return
2727
;;
2828
-s | --shell)
29-
_shells "${chroot-}"
29+
_comp_compgen_shells "${chroot-}"
3030
return
3131
;;
3232
esac

completions/_su

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ _comp_cmd_su()
1515

1616
case "$prev" in
1717
-s | --shell)
18-
_shells
18+
_comp_compgen_shells
1919
return
2020
;;
2121
-c | --command | --session-command)

completions/luseradd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ _comp_cmd_luseradd()
1818
return
1919
;;
2020
--shell | -${noargopts}s)
21-
_shells
21+
_comp_compgen_shells
2222
return
2323
;;
2424
--gid | -${noargopts}g)

completions/mussh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ _comp_cmd_mussh()
3030
return
3131
;;
3232
-s)
33-
_shells
33+
_comp_compgen_shells
3434
return
3535
;;
3636
-p | -h)

completions/screen

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ _comp_cmd_screen__sessions()
9696
return
9797
;;
9898
-*s)
99-
_shells
99+
_comp_compgen_shells
100100
return
101101
;;
102102
-*c)

completions/useradd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ _comp_cmd_useradd()
4242
return
4343
;;
4444
--shell | -${noargopts}s)
45-
_shells "${chroot-}"
45+
_comp_compgen_shells "${chroot-}"
4646
return
4747
;;
4848
esac

completions/usermod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ _comp_cmd_usermod()
4242
return
4343
;;
4444
--shell | -${noargopts}s)
45-
_shells "${chroot-}"
45+
_comp_compgen_shells "${chroot-}"
4646
return
4747
;;
4848
esac

0 commit comments

Comments
 (0)