-
Notifications
You must be signed in to change notification settings - Fork 1
/
group
executable file
·56 lines (50 loc) · 970 Bytes
/
group
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env bash
source "$rvm_scripts_path/base"
source "$rvm_scripts_path/version"
source "$rvm_scripts_path/functions/group"
source "$rvm_scripts_path/functions/utility"
group_add()
{
typeset user group
group="$1"
shift
for user in "$@"
do
if
__rvm_is_user_in_group "$group" "$user"
then
echo "User '$user' already in the group '$group'"
else
echo "Adding user '$user' to the group '$group'"
__rvm_add_user_to_group "$group" "$user"
fi
done
}
group_create()
{
typeset -a _params
_params=( "${1:-$rvm_group_name}" )
shift
if
(( $# ))
then
_params+=( "$1" )
else
if [[ "$1" == "${rvm_group_name}" && -n "${rvm_group_id:-}" ]]
then _params+=( "${rvm_group_id:-}" )
fi
fi
__rvm_create_group "${_params[@]}"
}
action="$1"
shift
true "${rvm_group_name:=rvm}"
case "$action" in
add|create|help)
group_$action "$@"
;;
*)
rvm_help group "$@"
false
;;
esac