about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthew Martin <phy1729@gmail.com>2016-09-07 23:19:01 +0200
committerOliver Kiddle <opk@zsh.org>2016-09-07 23:19:01 +0200
commit48c31e21d311d83384dcf21c20a3f5834b4b9425 (patch)
treedc71628e7391493712d3738d48ae3b833e732c13
parent1f429c06688afa4cb838a0c3d637d17fd0209a77 (diff)
downloadzsh-48c31e21d311d83384dcf21c20a3f5834b4b9425.tar.gz
zsh-48c31e21d311d83384dcf21c20a3f5834b4b9425.tar.xz
zsh-48c31e21d311d83384dcf21c20a3f5834b4b9425.zip
39208: Update flags
-rw-r--r--ChangeLog6
-rw-r--r--Completion/BSD/Command/_chflags42
2 files changed, 35 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index d3fe39a7f..c2d0193a3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2016-09-07  Oliver Kiddle  <opk@zsh.org>
 
+	39208: Matthew Martin: Completion/BSD/Command/_chflags:
+	Update flags
+
+	39223: Matthew Martin: Completion/BSD/Command/_chflags:
+	Introduce addflags function to reduce redundancy
+
 	39193: Completion/Unix/Type/_remote_files: don't pass options
 	from after -- on to compadd
 
diff --git a/Completion/BSD/Command/_chflags b/Completion/BSD/Command/_chflags
index 8147df009..726d0fddc 100644
--- a/Completion/BSD/Command/_chflags
+++ b/Completion/BSD/Command/_chflags
@@ -15,32 +15,48 @@ addflags() {
 }
 
 addflags \
-  nodump nodump \
-  opaque opaque \
   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 = (freebsd|dragonfly|darwin)* ]]; then
-  addflags \
-    hidden hidden \
-    uunlnk 'user undeletable'
+if [[ $OSTYPE = (darwin|dragonfly|freebsd|netbsd)* ]]; then
+  addflags opaque opaque
 
-  [[ $OSTYPE = freebsd* ]] && addflags \
-    offline offline \
-    rdonly readonly \
-    reparse 'Windows reparse point' \
-    sparse 'sparse file' \
-    system system
+  if [[ $OSTYPE = darwin* ]]; then
+    addflags hidden hidden
+  fi
+
+  if [[ $OSTYPE = (dragonfly|freebsd)* ]]; then
+    addlfags uunlnk 'user undeletable'
+    (( EUID )) || addflags sunlnk 'system undeletable'
+  fi
 
-  (( EUID )) || addflags sunlnk 'system undeletable'
+  [[ $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'
 
   args=(
     "-f[don't display diagnostic messages]"