Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Completion of swift fails when swift(1) is from Apple, not OpenStack



I was giving Apple's Swift programming language a try just now, and was
surprised to find out zshcompsys doesn't play nicely at all with swift(1) -- it
fails with an error.

Reproducer: with no swift(1) installed or swift(1) from Apple:

   $ autoload -Uz compinit; compinit
   $ swift <TAB>
   _values:compvalues:10: not enough arguments
   $ swift

and using _complete_debug (here[1] is the full log) I easily located the
culprit, _openstack, which was added in commit 89e319f34 and binds as many as
23 commands, including swift. 89e319f34 was first shipped in Zsh 5.3 in
December 2016. It makes assumptions about what swift --help should print, and
fails ungracefully when its expectations are off.

Now that the conflict is obvious, I wonder what's the best course of
action. For the reference, Swift is growing in popularity very rapidly; it
ranked #14 in 2016 on GitHub's list of most popular languages.[2] I don't know
how popular OpenStack is, let alone one of the 23 commands of its command-line
client, but I doubt it can beat *the* language of Apple platforms going
forward. Zsh 5.3 hasn't been out for very long, and Swift developers probably
haven't picked it up, since the latest version of macOS, 10.12.3, bundles Zsh
5.2. I'm afraid many people, who may not know how to program Zsh's compsys,
will be in for a big surprise when Apple bundles Zsh 5.3+ in the next major
macOS release.

Therefore, I suggest unbinding swift from _openstack. OpenStack folks can
always bind it back with compdef _openstack swift.

[1] https://gist.github.com/5a08aec1a4184325e0f2b52931473f92
[2] https://octoverse.github.com/


From 6563808d7bec41f66cf7e3b181e75ed19d32f2ac Mon Sep 17 00:00:00 2001
From: Zhiming Wang <zmwangx@xxxxxxxxx>
Date: Fri, 27 Jan 2017 22:23:35 -0500
Subject: [PATCH] _openstack: unbind swift

The name swift conflicts with the Swift compiler, the programming language for
Apple platforms (swift.org), which is arguably much more popular.

OpenStack folks who need completion for their swift could always bind it back:

   compdef _openstack swift
---
Completion/Unix/Command/_openstack | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Completion/Unix/Command/_openstack b/Completion/Unix/Command/_openstack
index 39fa30c3a..69e492156 100644
--- a/Completion/Unix/Command/_openstack
+++ b/Completion/Unix/Command/_openstack
@@ -1,4 +1,4 @@
-#compdef openstack aodh barbican ceilometer cinder cloudkitty designate glance gnocchi heat ironic keystone magnum manila mistral monasca murano neutron nova sahara senlin swift trove
+#compdef openstack aodh barbican ceilometer cinder cloudkitty designate glance gnocchi heat ironic keystone magnum manila mistral monasca murano neutron nova sahara senlin trove

# https://wiki.openstack.org/wiki/OpenStackClients
# http://docs.openstack.org/user-guide/common/cli-install-openstack-command-line-clients.html
--
2.11.0

Attachment: signature.asc
Description: Message signed with OpenPGP



Messages sorted by: Reverse Date, Date, Thread, Author