Search code examples
rubyrubygemsbash-completionzsh-completion

zsh/bash completion with ruby gem command tool


I created a command line ruby gem and would like to have bash or zsh completion. I created and versionned them, but I have to source them manually.

Is there a common way to execute scripts after the gem install, for example to edit the bashrc or zshrc and add the source command?


Solution

  • If you are using ruby gems:

    After installation your script, that placed in ./bin/ folder should automatically appeared in /usr/bin/ folder.

    zsh and bash on OS X automatically suggest me competition for all commands, that placed in /usr/bin/ directory.

    Possible problems, that can prevent code completions for your gem:

    • check, that your gem-file is executable (chmod +x file)
    • after installation open new terminal window to update shell settings.