Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Move bash plugin to it's own repository

  • Loading branch information...
commit f7cc7761351ad4f9f3957d834f2cdb62dc90679b 1 parent d2f1942
Seth Vargo sethvargo authored
Showing with 4 additions and 90 deletions.
  1. +4 −15 README.md
  2. +0 −75 berkshelf-complete.sh
19 README.md
View
@@ -32,21 +32,10 @@ Ruby 1.9 mode is required on all interpreters.
Ruby 1.9.1 and 1.9.2 are not officially supported. If you encounter problems, please upgrade to Ruby 2.0 or 1.9.3.
-Bash & Zsh Completion
----------------
-There is a [berkshelf bash completion script](https://raw.github.com/berkshelf/berkshelf/master/berkshelf-complete.sh). If you're using homebrew, you can install it like this:
-
- brew install bash-completion # if you haven't already
-
-Download the latest script
-
- (cd `brew --prefix`/etc/bash_completion.d && curl https://raw.github.com/berkshelf/berkshelf/master/berkshelf-complete.sh > berkshelf-complete.sh)
-
-And make sure you have this in your bash/zsh profile:
-
- [ -f `brew --prefix`/etc/bash_completion ] && source `brew --prefix`/etc/bash_completion
-
-If you prefer zsh, there is an [oh-my-zsh plugin](https://github.com/berkshelf/berkshelf-zsh-plugin) for command completion. Check the [README](https://github.com/berkshelf/berkshelf-zsh-plugin/blob/master/README.md) for details.
+Shell Completion
+----------------
+- [Bash](https://github.com/berkshelf/berkshelf-bash-plugin)
+- [ZSH](https://github.com/berkshelf/berkshelf-zsh-plugin)
Plugins
-------
75 berkshelf-complete.sh
View
@@ -1,75 +0,0 @@
-#!/bin/bash
-#
-# Description
-# Add tab completion for berkshelf
-#
-# Configuration:
-# BERKSHELF_BERKSFILE (default is 'Berksfile')
-#
-# Notes:
-# Must be added to your ~/.bashrc, ~/.zshrc, etc
-#
-# Author:
-# Seth Vargo <sethvargo@gmail.com>
-#
-# License:
-# Apache 2.0
-#
-
-_bundler() {
- which bundle > /dev/null 2>&1 && [ -f "$(pwd)/Gemfile" ]
-}
-
-# Overwrite berks to use bundler if defined
-_berks() {
- [ _bundler ] && bundle exec berks $@ || berks $@
-}
-
-_berkshelf_commands() {
- local cachefile=~/.berkshelf/.commands
- [ ! -f $cachefile ] && $(_berks help | grep berks | cut -d " " -f 4 > $cachefile)
- cat $cachefile
-}
-
-_berkshelf_cookbooks() {
- local file=${BERKSHELF_BERKSFILE:-Berksfile}
- if [ -e $file ]; then
- # strip all quotes from cookbook name and remove trailing comma, if any
- grep -w '^cookbook' $file \
- | awk '{ print $2 }' \
- | sed 's/"//g' \
- | sed "s/'//g" \
- | sed 's/,$//'
- fi
-}
-
-_local_cookbooks() {
- [ -d cookbooks ] && ls -d cookbooks/*/ | cut -d "/" -f 2
-}
-
-_berkshelf() {
- # local curr prev commands
- COMPREPLY=()
- curr="${COMP_WORDS[COMP_CWORD]}"
- prev="${COMP_WORDS[COMP_CWORD-1]}"
-
- # List of commands to complete
- commands=`_berkshelf_commands`
-
- case "${prev}" in
- "open"|"outdated"|"show"|"update"|"upload")
- local berkshelf_cookbooks=`_berkshelf_cookbooks`
- local local_cookbooks=`_local_cookbooks`
- local cookbooks=`echo $berkshelf_cookbooks $local_cookbooks | sort -n | uniq`
- COMPREPLY=($(compgen -W "${cookbooks}" -- ${curr}))
- return 0
- ;;
- *)
- ;;
- esac
-
- COMPREPLY=($(compgen -W "${commands}" -- ${curr}))
- return 0
-}
-
-complete -F _berkshelf berks
Please sign in to comment.
Something went wrong with that request. Please try again.