Skip to content

Commit 1f8e77c

Browse files
committed
refactor: rename { => _comp_compgen}_shells
1 parent 6e0d67e commit 1f8e77c

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
@@ -2094,15 +2094,17 @@ _comp_selinux_users()
20942094
}
20952095

20962096
# This function completes on valid shells
2097-
#
20982097
# @param $1 chroot to search from
2099-
# TODO:API: rename per conventions
2100-
_shells()
2098+
#
2099+
# @since 2.12
2100+
_comp_compgen_shells()
21012101
{
2102-
local shell rest
2103-
while read -r shell rest; do
2104-
[[ $shell == /* && $shell == "$cur"* ]] && COMPREPLY+=("$shell")
2102+
local -a shells=()
2103+
local _shell _rest
2104+
while read -r _shell _rest; do
2105+
[[ $_shell == /* ]] && shells+=("$_shell")
21052106
done 2>/dev/null <"${1-}"/etc/shells
2107+
_comp_compgen -U shells -- -W '"${shells[@]}"'
21062108
}
21072109

21082110
# 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
@@ -414,6 +414,12 @@ _allowed_groups()
414414
_comp_compgen -c "${1:-$cur}" allowed_groups
415415
}
416416

417+
# @deprecated 2.12 Use `_comp_compgen -a shells`
418+
_shells()
419+
{
420+
_comp_compgen -a shells
421+
}
422+
417423
# @deprecated 2.12 Use `_comp_compgen -a fstypes`
418424
_fstypes()
419425
{

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)