Skip to content

Commit

Permalink
Version 2.3.0: ppl grep
Browse files Browse the repository at this point in the history
With thanks to @ajford for the excellent feature request, version 2.3.0 brings a
new command: ppl grep. This command leverages the
extremely high speed search git grep repository search in order to provide
near-instant search results.

    $ ppl grep smith
    john.vcf:EMAIL:john.smith@example.org
  • Loading branch information
henrycatalinismith committed Oct 12, 2013
2 parents a6de6f4 + aba10e9 commit 73f3528
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 2 deletions.
1 change: 1 addition & 0 deletions completions/bash
Expand Up @@ -189,6 +189,7 @@ __ppl_commands()
echo "bday"
echo "completion"
echo "email"
echo "grep"
echo "init"
echo "ls"
echo "mutt"
Expand Down
10 changes: 10 additions & 0 deletions features/grep.feature
@@ -0,0 +1,10 @@

Feature: ppl grep

Scenario: Search for matching lines using git grep
Given I am in an address book with a blank contact called bob
And bob's name is "Robert Testing"
And bob's email address is "bob@example.org"
Then running "ppl grep bob" should output 1 line
And the 1st line should be "bob.vcf:EMAIL:bob@example.org"

7 changes: 7 additions & 0 deletions lib/ppl/application/bootstrap.rb
Expand Up @@ -52,6 +52,12 @@ class Ppl::Application::Bootstrap
help
end

register :command_grep do
grep = Ppl::Command::External.new("grep", "git grep", "Execute 'git grep' in the address book directory")
grep.storage = storage_adapter
grep
end

register :command_init do
init = Ppl::Command::Init.new
init.storage = storage_adapter
Expand Down Expand Up @@ -187,6 +193,7 @@ class Ppl::Application::Bootstrap
suite.add_command command_bday
suite.add_command command_completion
suite.add_command command_email
suite.add_command command_grep
suite.add_command command_help
suite.add_command command_init
suite.add_command command_ls
Expand Down
4 changes: 2 additions & 2 deletions ppl.gemspec
Expand Up @@ -2,8 +2,8 @@
Gem::Specification.new do |spec|

spec.name = "ppl"
spec.version = "2.2.0"
spec.date = "2013-07-20"
spec.version = "2.3.0"
spec.date = "2013-10-12"

spec.required_ruby_version = ">= 1.9.3"

Expand Down
9 changes: 9 additions & 0 deletions spec/ppl/application/bootstrap_spec.rb
Expand Up @@ -43,6 +43,12 @@
end
end

describe "#command_grep" do
it "should return a command" do
@bootstrap.command_grep.should be_a(Ppl::Application::Command)
end
end

describe "#command_help" do
it "should return a Ppl::Command::Help" do
@bootstrap.command_help.should be_a(Ppl::Command::Help)
Expand Down Expand Up @@ -437,6 +443,9 @@
it "should contain the 'email' command" do
@bootstrap.command_suite.find_command("email").should_not be nil
end
it "should contain the 'grep' command" do
@bootstrap.command_suite.find_command("grep").should_not be nil
end
it "should contain the 'init' command" do
@bootstrap.command_suite.find_command("init").should_not be nil
end
Expand Down

0 comments on commit 73f3528

Please sign in to comment.