#!/bin/sh

# Search your bundle for the provided pattern
#   Requires bundler 1.8+ for execution as a bundler subcommand.
#   Examples:
#     bundle search Kernel.warn
#     bundle search current_user clearance
#     bundle search "Change your password" clearance
#
# Arguments:
#  1. What to search for
#  2. Which gem names to search (defaults to all gems)

pattern="$1"; shift
ag "$pattern" $(bundle show --paths "$@")
