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

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



Here is a swing at giving filename completion, i don't have access to os x
or openstack to really test it or add actual completion for apple's swift.

From 59a1296b6e154974324cc6109cec4943f66fbeec Mon Sep 17 00:00:00 2001
From: Eric Cook <llua@xxxxxxx>
Date: Sat, 28 Jan 2017 14:49:53 -0500
Subject: [PATCH] create stub swift function

---
 Completion/Unix/Command/_openstack |  2 +-
 Completion/Unix/Command/_swift     | 13 +++++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)
 create mode 100644 Completion/Unix/Command/_swift

diff --git a/Completion/Unix/Command/_openstack b/Completion/Unix/Command/_openstack
index 39fa30c..69e4921 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
diff --git a/Completion/Unix/Command/_swift b/Completion/Unix/Command/_swift
new file mode 100644
index 0000000..b29cc35
--- /dev/null
+++ b/Completion/Unix/Command/_swift
@@ -0,0 +1,13 @@
+#compdef swift
+
+local variant ret=1
+if _pick_variant -r variant apple='OVERVIEW: Swift compiler' openstack --help; then
+  case $variant in
+    apple)
+      _call_function ret _default;;
+    openstack)
+      _call_function ret _openstack;;
+  esac
+
+  return ret
+fi
-- 
2.9.2



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