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

OpenStack CLI completion



Hi,

I stumbled upon a bug in the completion for openstack command
introduced in https://www.zsh.org/mla/workers/2016/msg01936.html

I noticed that the suggestions stop for further subcommands at a certain point.
An example:
`openstack vpn <tab>` offers "endpoint", "ike", "ipsec" and "service"
– perfect, selecting "ipsec"!
`openstack vpn ipsec <tab>` offers nothing – It should offer "policy",
"site" as can be seen here:

# I removed flag suggestions -* for readability reasons
❯ echo $_cache_openstack_clnt_outputs |grep cmds_vpn_ipsec |sed
"s/='-.*/='...'/"
  cmds_vpn_ipsec='policy site'
  cmds_vpn_ipsec_policy='create delete list set show'
  cmds_vpn_ipsec_policy_create='...'
  cmds_vpn_ipsec_policy_delete='...'
  cmds_vpn_ipsec_policy_list='...'
  cmds_vpn_ipsec_policy_set='...'
  cmds_vpn_ipsec_policy_show='...'
  cmds_vpn_ipsec_site='connection'
  cmds_vpn_ipsec_site_connection='create delete list set show'
  cmds_vpn_ipsec_site_connection_create='...'
  cmds_vpn_ipsec_site_connection_delete='...'
  cmds_vpn_ipsec_site_connection_list='...'
  cmds_vpn_ipsec_site_connection_set='...'
  cmds_vpn_ipsec_site_connection_show='...'

This issue continues after selecting "site"
`openstack vpn ipsec site <tab>` , no offers – should be "connection"
(only one, see above)
`openstack vpn ipsec site connection <tab>` no offers – should be
"create", "delete", "list", "set" and "show"

In the thread it was introduced in, there were some discussions
whether it should be included in zsh or in the openstack project. Is
there interest in a patch to fix this?

I have some idea how to fix this by making some assumptions but I am
not certain it's the right way. I would probably get rid of $subcmd
and just take the longest string of words connected by underscores as
$cmd to find the right suggestions.
Some barriers I currently have:
* There is also some substitution going on for colon which I just don't get
* Why is there a check for not prefix-needed?

Some comments from the original author would be quite helpful if he
still remembers why it was done a certain way :)

Best,
Christian




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