From eb2abf4408c8a39a8a7aa6ab4f9e37aba6940fa6 Mon Sep 17 00:00:00 2001 From: Mr Rogers Date: Wed, 17 Jun 2015 08:46:54 -0700 Subject: [PATCH] Add autocomplete script to the gem * add post install message * add autocomplete script from @alexeyshockov --- extras/lunchy-completion.bash | 18 ++++++++++++++++++ lunchy.gemspec | 17 +++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 extras/lunchy-completion.bash diff --git a/extras/lunchy-completion.bash b/extras/lunchy-completion.bash new file mode 100644 index 0000000..340ec3a --- /dev/null +++ b/extras/lunchy-completion.bash @@ -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 diff --git a/lunchy.gemspec b/lunchy.gemspec index 8c47d62..fc665dd 100644 --- a/lunchy.gemspec +++ b/lunchy.gemspec @@ -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 @@ -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"