zsh-workers
 help / color / mirror / code / Atom feed
* Completion of swift fails when swift(1) is from Apple, not OpenStack
@ 2017-01-28 17:34 Zhiming Wang
  2017-01-28 17:42 ` Zhiming Wang
  2017-01-28 18:08 ` Bart Schaefer
  0 siblings, 2 replies; 6+ messages in thread
From: Zhiming Wang @ 2017-01-28 17:34 UTC (permalink / raw)
  To: Zsh hackers list

[-- Attachment #1: Type: text/plain, Size: 2961 bytes --]

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@gmail.com>
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 #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

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

end of thread, other threads:[~2017-01-28 20:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-28 17:34 Completion of swift fails when swift(1) is from Apple, not OpenStack Zhiming Wang
2017-01-28 17:42 ` Zhiming Wang
2017-01-28 18:08 ` Bart Schaefer
2017-01-28 19:54   ` Eric Cook
2017-01-28 20:40   ` Zhiming Wang
2017-01-28 20:52     ` Zhiming Wang

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).