Permalink
Browse files

Added basic `bundle` support

  • Loading branch information...
mernen committed Mar 7, 2011
1 parent 81a5ee5 commit 6d964ebbb92406db216e2e129b006ccd3e34827a
Showing with 56 additions and 0 deletions.
  1. +55 −0 completion-bundle
  2. +1 −0 completion-ruby-all
View
@@ -0,0 +1,55 @@
+#! bash
+# bash completion for the `bundle` command.
+#
+# Copyright (c) 2011 Daniel Luz <dev at mernen dot com>.
+# Distributed under the MIT license.
+# http://mernen.com/projects/completion-ruby
+#
+# To use, source this file on bash:
+# . completion-bundle
+
+__bundle() {
+ local cur=$2
+ local prev=$3
+ local bundle_command
+ __bundle_get_command
+ COMPREPLY=()
+
+ local options
+ if [[ $cur == -* ]]; then
+ options="--no-color --verbose"
+ if [[ -z $bundle_command ]]; then
+ options="$options --version --help"
+ fi
+ else
+ if [[ -z $bundle_command || $bundle_command == help ]]; then
+ options="help install update package exec config check list show
+ console open viz init gem"
+ fi
+ fi
+ COMPREPLY=($(compgen -W "$options" -- "$cur"))
+}
+
+__bundle_get_command() {
+ local i
+ for ((i=1; i < $COMP_CWORD; ++i)); do
+ local arg=${COMP_WORDS[$i]}
+
+ case $arg in
+ [^-]*)
+ bundle_command=$arg
+ return;;
+ --version)
+ # command-killer
+ bundle_command=-
+ return;;
+ --help)
+ bundle_command=help
+ return;;
+ esac
+ done
+}
+
+
+complete -F __bundle -o default bundle
+# vim: ai ft=sh sw=4 sts=2 et
View
@@ -30,6 +30,7 @@ _cr_load() {
_cr_load gem gem1.8 gem1.9 jgem
_cr_load jruby
_cr_load rails
+_cr_load bundle
_cr_load rake
_cr_load ruby ruby1.8 ruby1.9

0 comments on commit 6d964eb

Please sign in to comment.