Sha256: ef2e3f2f9d7aa3760869d2d2860b27e1d59fde931adff39d25370f2ddd12a62c

Contents?: true

Size: 1.16 KB

Versions: 14

Compression:

Stored size: 1.16 KB

Contents

# -*- zsh -*-
#
# Completion for zsh:
# (based on <http://d.hatena.ne.jp/rubikitch/20071002/zshcomplete>)
#
# (1) install this file.
#      mkdir -p ~/.zsh.d
#      cp rb_optparse.zsh ~/.zsh.d/rb_optparse.zsh
#
# (2) load the script, and add a directory to fpath before compinit.
#      echo '. ~/.zsh.d/rb_optparse.zsh' >> "${ZDOTDIR:-~}/.zshrc"
#      echo 'fpath=(~/.zsh.d/Completion $fpath)' >> "${ZDOTDIR:-~}/.zshrc"
#      echo 'autoload -U compinit; compinit' >> "${ZDOTDIR:-~}/.zshrc"
#
# (3) restart zsh.
#
# (4) generate completion files once.
#      generate-complete-function/ruby/optparse COMMAND1
#      generate-complete-function/ruby/optparse COMMAND2
#

generate-complete-function/ruby/optparse ()
{
    local cmpl="_${1:t}"
    mkdir -p "${ZSH_COMPLETION_DIR-$HOME/.zsh.d/Completion}"
    $1 "--*-completion-zsh=${1:t}" >! "${ZSH_COMPLETION_DIR-$HOME/.zsh.d/Completion}/$cmpl"
    if [[ $(type -w "$cmpl") == "${cmpl}: function" ]]; then
        unfunction "$cmpl"
        autoload -U "$cmpl"
    else
        compinit "$cmpl"
    fi
}

compdef _command generate-complete-function/ruby/optparse

for cmd in "$@"; do
    generate-complete-function/ruby/optparse "$cmd"
done

Version data entries

14 entries across 14 versions & 3 rubygems

Version Path
optparse-0.6.0 misc/rb_optparse.zsh
optparse-0.5.0 misc/rb_optparse.zsh
cli-option_parser.rb-0.6.0 misc/rb_optparse.zsh
cli-option_parser.rb-0.5.3 misc/rb_optparse.zsh
cli-option_parser.rb-0.5.2 misc/rb_optparse.zsh
cmd-optparse.rb-0.5.2 misc/rb_optparse.zsh
cmd-optparse.rb-0.5.0 misc/rb_optparse.zsh
cmd-optparse.rb-0.1.1 misc/rb_optparse.zsh
cmd-optparse.rb-0.1.0 misc/rb_optparse.zsh
optparse-0.4.0 misc/rb_optparse.zsh
optparse-0.3.1 misc/rb_optparse.zsh
optparse-0.3.0 misc/rb_optparse.zsh
optparse-0.2.0 misc/rb_optparse.zsh
optparse-0.1.1 misc/rb_optparse.zsh