ppl 1.17.0 → 1.17.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/completions/bash +1 -1
- data/completions/zsh +1 -1
- data/lib/ppl.rb +1 -1
- data/lib/ppl/application/output.rb +8 -2
- data/lib/ppl/application/shell.rb +10 -0
- data/lib/ppl/command/mutt.rb +4 -3
- data/ppl.gemspec +1 -1
- data/spec/ppl/adapter/output_spec.rb +12 -0
- data/spec/ppl/adapter/vcard/greencard_spec.rb +1 -0
- data/spec/ppl/command/mutt_spec.rb +20 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ecd0486206406d56c76fb117e670366c7a9397d6
|
4
|
+
data.tar.gz: 28772223134972c6b129ad759dcfbcf02d030d7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1887503ef58bbcd1df760d0fc07e61ae2799e83e29994f7097b690b3a043bf65b1abc5be315a4bbceb84cffd616769f01e16c861bb231f533af53d69a61e736e
|
7
|
+
data.tar.gz: 45268a4da3b16be35c6cb572f48427a7c9d9f5dd07a820c7d317469e080554f6d2f077e4fcab932f13df863b0cf2e5d02f801b2a412139d4cb3690fd82f2e044
|
data/completions/bash
CHANGED
@@ -15,7 +15,7 @@ _ppl()
|
|
15
15
|
# Complete nicknames
|
16
16
|
nick_cmds=([age]="" [bday]="" [email]="" [mv]="" [name]="" [nick]="" [org]="" [phone]="" [post]="" [rm]="" [show]="" [url]="")
|
17
17
|
if [[ $nick_cmds[${prev}] ]]; then
|
18
|
-
local nicknames=$(for x in `ppl nick | cut -d ':' -f 1`; do echo ${x} ; done )
|
18
|
+
local nicknames=$(for x in `ppl nick | cut -d ':' -f 1 | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"`; do echo ${x} ; done )
|
19
19
|
COMPREPLY=( $(compgen -W "${nicknames}" -- ${cur}) )
|
20
20
|
return 0
|
21
21
|
fi
|
data/completions/zsh
CHANGED
data/lib/ppl.rb
CHANGED
@@ -10,13 +10,19 @@ class Ppl::Application::Output
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def error(string)
|
13
|
-
@stderr.puts string
|
13
|
+
@stderr.puts sanitise(string)
|
14
14
|
end
|
15
15
|
|
16
16
|
def line(string)
|
17
|
-
@stdout.puts string
|
17
|
+
@stdout.puts sanitise(string)
|
18
18
|
true
|
19
19
|
end
|
20
20
|
|
21
|
+
private
|
22
|
+
|
23
|
+
def sanitise(string)
|
24
|
+
string.delete "\r"
|
25
|
+
end
|
26
|
+
|
21
27
|
end
|
22
28
|
|
@@ -7,9 +7,19 @@ class Ppl::Application::Shell
|
|
7
7
|
|
8
8
|
def run(input, output)
|
9
9
|
outcome = false
|
10
|
+
begin
|
10
11
|
command = select_command(input)
|
11
12
|
prepare_command(command, input)
|
12
13
|
outcome = execute_command(command, input, output)
|
14
|
+
rescue Ppl::Error::ContactNotFound
|
15
|
+
output.error("ppl: Contact '#{$!}' not found")
|
16
|
+
rescue OptionParser::InvalidOption, OptionParser::MissingArgument, Ppl::Error::IncorrectUsage
|
17
|
+
output.error($!)
|
18
|
+
output.error(@optparse.to_s)
|
19
|
+
rescue
|
20
|
+
output.error("ppl: " + $!.message)
|
21
|
+
outcome = false
|
22
|
+
end
|
13
23
|
return outcome
|
14
24
|
end
|
15
25
|
|
data/lib/ppl/command/mutt.rb
CHANGED
@@ -39,6 +39,7 @@ class Ppl::Command::Mutt < Ppl::Application::Command
|
|
39
39
|
def select_matching_contacts(address_book, query)
|
40
40
|
matches = Ppl::Entity::AddressBook.new
|
41
41
|
address_book.contacts.each do |contact|
|
42
|
+
contact = contact.dup
|
42
43
|
if contact.email_addresses.empty?
|
43
44
|
next
|
44
45
|
elsif match_by_name(contact, query)
|
@@ -82,9 +83,9 @@ class Ppl::Command::Mutt < Ppl::Application::Command
|
|
82
83
|
|
83
84
|
def describe_matches(matches)
|
84
85
|
summary = sprintf(
|
85
|
-
"Searching address book... %d
|
86
|
-
@address_book.contacts.length,
|
87
|
-
matches.contacts.length
|
86
|
+
"Searching address book... %d email addresses... %d matching:",
|
87
|
+
@address_book.contacts.inject(0) { |total, c| total += c.email_addresses.length },
|
88
|
+
matches.contacts.inject(0) { |total, c| total += c.email_addresses.length }
|
88
89
|
)
|
89
90
|
results = @format.process(matches)
|
90
91
|
[summary, results].join("\n").strip
|
data/ppl.gemspec
CHANGED
@@ -37,6 +37,18 @@ describe Ppl::Application::Output do
|
|
37
37
|
@stdout.should_receive(:puts).with(string)
|
38
38
|
@output.line(string)
|
39
39
|
end
|
40
|
+
|
41
|
+
it "should not send carriage returns to stdout" do
|
42
|
+
string = "The quick brown fox
|
43
|
+
@stdout.should_receive(:puts).with("The quick brown fox")
|
44
|
+
@output.line(string)
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should not send carriage returns to stderr" do
|
48
|
+
string = "The quick brown fox
|
49
|
+
@stderr.should_receive(:puts).with("The quick brown fox")
|
50
|
+
@output.error(string)
|
51
|
+
end
|
40
52
|
end
|
41
53
|
|
42
54
|
end
|
@@ -45,7 +45,7 @@ describe Ppl::Command::Mutt do
|
|
45
45
|
@storage.should_receive(:load_address_book).and_return(@address_book)
|
46
46
|
@format.should_receive(:process).and_return("test@example.org\tTest User")
|
47
47
|
@output.should_receive(:line) do |line|
|
48
|
-
line.should include "Searching address book... 1
|
48
|
+
line.should include "Searching address book... 1 email addresses... 1 matching:"
|
49
49
|
line.should include "test@example.org\tTest User"
|
50
50
|
end
|
51
51
|
@command.execute(@input, @output).should eq true
|
@@ -78,12 +78,30 @@ describe Ppl::Command::Mutt do
|
|
78
78
|
@storage.should_receive(:load_address_book).and_return(@address_book)
|
79
79
|
@format.should_receive(:process).and_return("test@example.org\tTest User")
|
80
80
|
@output.should_receive(:line) do |line|
|
81
|
-
line.should include "Searching address book... 1
|
81
|
+
line.should include "Searching address book... 1 email addresses... 1 matching:"
|
82
82
|
line.should include "test@example.org\tTest User"
|
83
83
|
end
|
84
84
|
@command.execute(@input, @output).should eq true
|
85
85
|
end
|
86
86
|
|
87
|
+
|
88
|
+
it "should count up email addresses in the status line" do
|
89
|
+
@input.arguments.push "org"
|
90
|
+
|
91
|
+
@contact.name = "Test User"
|
92
|
+
@contact.email_addresses.push "test@test.org"
|
93
|
+
@contact.email_addresses.push "prova@prova.org"
|
94
|
+
@address_book.contacts << @contact
|
95
|
+
|
96
|
+
@storage.stub(:load_address_book).and_return(@address_book)
|
97
|
+
@format.stub(:process)
|
98
|
+
@output.stub(:line)
|
99
|
+
@output.should_receive(:line) do |line|
|
100
|
+
line.should include "Searching address book... 2 email addresses... 2 matching:"
|
101
|
+
end
|
102
|
+
@command.execute(@input, @output)
|
103
|
+
end
|
104
|
+
|
87
105
|
end
|
88
106
|
|
89
107
|
describe "#execute (case-insensitive)" do
|