Skip to content

Commit 7bc943f

Browse files
committed
Add _comp_cmd_chflags
1 parent 4c98ce5 commit 7bc943f

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

completions/chflags

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# chflags(1) completion -*- shell-script -*-
2+
3+
_comp_cmd_chflags()
4+
{
5+
local cur prev words cword comp_args
6+
_comp_initialize -- "$@" || return
7+
8+
if [[ $cur == -* ]]; then
9+
# Complete -options
10+
local w opts=""
11+
for w in "${words[@]}"; do
12+
[[ $w == -R ]] && opts="-H -L -P" && break
13+
done
14+
_comp_compgen -- -W '-f -h -v -R $opts'
15+
else
16+
local ret
17+
# The first argument is a list of flags; the rest are filedir.
18+
_comp_count_args
19+
if ((ret == 1)); then
20+
_comp_delimited , -W 'simmutable nosimmutable sappend nosappend
21+
archived noarchived opaque noopaque nodump
22+
dump uimmutable nouimmutable uappend
23+
nouappend hidden nohidden'
24+
else
25+
_comp_compgen_filedir
26+
fi
27+
fi
28+
} &&
29+
complete -F _comp_cmd_chflags chflags
30+
31+
# ex: filetype=sh

0 commit comments

Comments
 (0)