Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

writing own oh-my-zsh plugin

I want to write a simple plugin for oh-my-zsh completing only possible server arguments.

Example 1:

$ myserver st    # hits tab
start stop

Example 2:

$ myserver    # hits tab
start stop restart

According to wiki I have created file named ~/.oh-my-zsh/custom/plugins/myserver/myserver.plugin.zsh with sample content of coffee plugin (I tried brew plugin as well) but completition doesn't work (any of described in file). Moreover error is thrown:

_arguments:comparguments:312: can only be called from completion function

I checked similar problems and my fpath includes ~/.oh-my-zsh/custom/plugins/myserver.

What am I missing? This should be pretty simple... Thanks for help

like image 784
petrbel Avatar asked Sep 30 '14 12:09

petrbel


1 Answers

From your post I'd assume that you have named the file myserver.plugin.zsh, however, if it is used to define a completion function its name must start with an underscore. It seems to be customary that the underscore is followed by the command name, i.e. in your case _myserver.

However, without the explicit code you are using I can not help you any further. You might want to check this blog post for further help.

I should remark that it is completely unnecessary to design a completion function as oh-my-zsh plugin; just create it as standalone piece of code.

like image 61
elemakil Avatar answered Sep 23 '22 17:09

elemakil