-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathchmod.sh
43 lines (41 loc) · 1 KB
/
chmod.sh
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
_patch_table() {
_patch_table_edit_arguments ';;' 'args;~[`_choice_args`]'
}
_choice_args() {
if [[ -n "$argc_reference" ]]; then
_argc_util_comp_path
else
len="${#argc__positionals[@]}"
if [[ "$len" -lt 2 ]]; then
_choice_mode
else
_argc_util_comp_path
fi
fi
}
_choice_mode() {
prefix="${ARGC_CWORD%,*},"
filter="${ARGC_CWORD##*,}"
echo "__argc_prefix=$ARGC_CWORD"
echo __argc_filter=
if [[ "$filter" == *'+'* ]] || [[ "$filter" == *'-'* ]] || [[ "$filter" == *'='* ]]; then
filter="$filter+-="
fi
if [[ "$filter" == *'u'* ]] || [[ "$filter" == *'g'* ]] || [[ "$filter" == *'o'* ]]; then
filter="${filter}ugo"
fi
cat <<-'EOF' | _argc_util_filter "$filter" | _argc_util_transform nospace
+
-
=
r read
s set uid/gid
t sticky
w write
x execute
X execute only if directory or executable to another
u owner's current permissions
g group's current permissions
o others' current permissions
EOF
}