zsh-workers
 help / color / mirror / code / Atom feed
* [patch] _rmdir
@ 2018-04-28  5:01 Matthew Martin
  2018-04-29 23:21 ` Oliver Kiddle
  0 siblings, 1 reply; 2+ messages in thread
From: Matthew Martin @ 2018-04-28  5:01 UTC (permalink / raw)
  To: zsh-workers

Complete the options for rmdir.

Is there an established position for --help and --version? Completing
them would be more complete, but also useless noise in my opinion.

- Matthew Martin


diff --git a/Completion/Unix/Command/_rmdir b/Completion/Unix/Command/_rmdir
new file mode 100644
index 000000000..0f5e16912
--- /dev/null
+++ b/Completion/Unix/Command/_rmdir
@@ -0,0 +1,23 @@
+#compdef rmdir grmdir
+
+local -a args
+
+args=(
+  '(-p --parents)'{-p,--parents}'[remove each component of the specified paths]'
+)
+
+if _pick_variant gnu=GNU unix --version; then
+  args+=(
+    '--ignore-fail-on-non-empty[ignore failure if directory is non-empty]'
+    '(-v --verbose)'{-v,--verbose}'[be verbose]'
+  )
+else
+  args=(${args:#*\)--*})
+  if [[ $OSTYPE == (dragonfly|freebsd)* ]]; then
+    args+=('-v[be verbose]')
+  fi
+fi
+
+_arguments -s -S -A '-*' \
+  $args \
+  '*:directories:_directories'
diff --git a/Completion/Unix/Type/_directories b/Completion/Unix/Type/_directories
index 456af3b6c..438181eec 100644
--- a/Completion/Unix/Type/_directories
+++ b/Completion/Unix/Type/_directories
@@ -1,4 +1,4 @@
-#compdef rmdir grmdir zf_rmdir dircmp -P -value-,*path,-default-
+#compdef zf_rmdir dircmp -P -value-,*path,-default-
 
 local expl
 


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [patch] _rmdir
  2018-04-28  5:01 [patch] _rmdir Matthew Martin
@ 2018-04-29 23:21 ` Oliver Kiddle
  0 siblings, 0 replies; 2+ messages in thread
From: Oliver Kiddle @ 2018-04-29 23:21 UTC (permalink / raw)
  To: zsh-workers

Matthew Martin wrote:
>
> Is there an established position for --help and --version? Completing
> them would be more complete, but also useless noise in my opinion.

With most zsh completion things, the established position is to include
them and leave it up to the user to disable what they don't want with
styles. There are things I wouldn't include like deprecated options but I
do tend to include --help and --version. Completing them can be useful.

So if you find them to be useless noise, you can set:

  zstyle ':completion:*:options' ignored-patterns '--(help|usage|version)'

You might prefer to apply the hidden style to them using a tag-order
style with labels.

Unfortunately, where the option is just -h, -?, -v or -V your options
are limited. We perhaps need some way to select matches by description.
Or we could expand the groups functionality in _arguments to make, e.g.
the '?' group special.

Oliver


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-04-29 23:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-28  5:01 [patch] _rmdir Matthew Martin
2018-04-29 23:21 ` Oliver Kiddle

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).