Skip to content

Commit

Permalink
Add autocomplete script to the gem
Browse files Browse the repository at this point in the history
* add post install message
* add autocomplete script from @alexeyshockov
  • Loading branch information
bunnymatic committed Jun 17, 2015
1 parent 55fada5 commit eb2abf4
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
18 changes: 18 additions & 0 deletions extras/lunchy-completion.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
###
# completion written by Alexey Shockov
# on github : alexeyshockov
#
function _lunchy {
COMPREPLY=()
local cur=${COMP_WORDS[COMP_CWORD]}
local cur_pos=$COMP_CWORD;

case "$cur_pos" in
1) COMPREPLY=($(compgen -W 'ls list start stop restart status install uninstall show edit' -- $cur))
;;
*) COMPREPLY=($(compgen -W '$(lunchy list)' -- $cur))
;;
esac
}

complete -F _lunchy -o default lunchy
17 changes: 17 additions & 0 deletions lunchy.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
# -*- encoding: utf-8 -*-
require "./lib/lunchy"

post_install_message = <<-EOS
-------
Thanks for installing Lunchy. We know you're going to love it!
If you want to add tab-completion (for bash), add the following
to your .bash_profile, .bashrc or .profile
LUNCHY_DIR=$(dirname `gem which lunchy`)/../extras
if [ -f $LUNCH_DIR/lunchy-completion.bash ]; then
. $LUNCHY_DIR/lunchy-completion.bash
fi
-------
EOS

Gem::Specification.new do |s|
s.name = "lunchy"
s.version = Lunchy::VERSION
Expand All @@ -9,6 +25,7 @@ Gem::Specification.new do |s|
s.email = ["mperham@gmail.com"]
s.homepage = "http://github.com/mperham/lunchy"
s.summary = s.description = %q{Friendly wrapper around launchctl}
s.post_install_message = post_install_message
s.licenses = ['MIT']

s.add_development_dependency "rake"
Expand Down

0 comments on commit eb2abf4

Please sign in to comment.