diff options
Diffstat (limited to 'Completion/BSD/Command/_chflags')
-rw-r--r-- | Completion/BSD/Command/_chflags | 66 |
1 files changed, 5 insertions, 61 deletions
diff --git a/Completion/BSD/Command/_chflags b/Completion/BSD/Command/_chflags index 075782cd9..924b09acd 100644 --- a/Completion/BSD/Command/_chflags +++ b/Completion/BSD/Command/_chflags @@ -1,64 +1,8 @@ #compdef chflags -local flags args own='-g *(-u$EUID)' +local args own='-g *(-u$EUID)' -addflags() { - for 1 2; do - if [[ $1 = no* ]]; then - flags+=("(${1#no})$1[set the $2 flag]" - "($1)${1#no}[unset the $2 flag]") - else - flags+=("(no$1)$1[set the $2 flag]" - "($1)no$1[unset the $2 flag]") - fi - done -} - -addflags \ - uappnd 'user append-only' \ - uchg 'user immutable' - -if (( ! EUID )); then - addflags \ - arch archived \ - nodump nodump \ - sappnd 'system append-only' \ - schg 'system immutable' - unset own -fi - -if [[ $OSTYPE = (darwin|dragonfly|freebsd|netbsd)* ]]; then - addflags opaque opaque - - if [[ $OSTYPE = darwin* ]]; then - addflags hidden hidden - fi - - if [[ $OSTYPE = (dragonfly|freebsd)* ]]; then - addflags uunlnk 'user undeletable' - (( EUID )) || addflags sunlnk 'system undeletable' - fi - - [[ $OSTYPE = dragonflybsd* ]] && { - addflags \ - cache XXX \ - nouhistory 'user nohistory' - - (( EUID )) || addflags \ - noscache XXX \ - noshistory 'system nohistory' - } - - [[ $OSTYPE = freebsd* ]] && addflags \ - uarch archive \ - uhidden hidden \ - uoffline offline \ - urdonly 'DOS, Windows and CIFS readonly' \ - ureparse 'Windows reparse point' \ - usparse 'sparse file' \ - usystem 'DOS, Windows and CIFS system' - -fi +(( ! EUID || $+_comp_priv_prefix )) && own= if [[ $OSTYPE = (darwin|dragonfly|freebsd)* ]]; then args=( @@ -68,12 +12,12 @@ if [[ $OSTYPE = (darwin|dragonfly|freebsd)* ]]; then fi _arguments -s -A "-*" : $args \ + ': :_file_flags' \ + '*:file:_files "$own"' \ - opth \ '-h[act on symlinks]' \ - optR \ '-R[recurse directories]' \ '(-L -P)-H[follow symlinks on the command line (specify with -R)]' \ '(-H -P)-L[follow all symlinks (specify with -R)]' \ - '(-L -H)-P[do not follow symlinks (specify with -R)]' \ - ':file flag:_values -s , "file flags" $flags[@]' \ - '*:file:_files "$own"' + '(-L -H)-P[do not follow symlinks (specify with -R)]' |