ppl 1.19.0 → 1.20.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1e392faaea1882705856f5dbe483e493ca0c427a
4
- data.tar.gz: 2334459a46cc72d92aa8c3c2f0a500a15de3fb5c
3
+ metadata.gz: f2c1a083b23b90a24e6f81e381593c1ed37150e1
4
+ data.tar.gz: e8477cde9b1eec569179e8695c65da79878f5925
5
5
  SHA512:
6
- metadata.gz: 6227509847307b130c84049c0ce92063ea9079320e76e9530021a0fe7b3cd75425e1276abc2fbc35dcb2e6c0bb85f0c44181cd5235362e9fca4764f167cab584
7
- data.tar.gz: 0e737fbd7ec0817918693c406587efab38d7f8f3dc8eb1f11577669665cf2a0750e5fdf70c6c445716848e94e6d45aeb7d47f6d316eb2625937c120e1cff60bc
6
+ metadata.gz: 6526a4a9e7a9aebfb8172736570852731ec890e15c5d74be9851a89c9a4f34c3599d0c10368252a038aafa6a7e4a8b6ca127821dd3e035b16af2cbc4d12969a0
7
+ data.tar.gz: a8abdf21b1ef7faea30160279c1fcf0e7ebf1e71138e1c8232ffdd2ea9b893a1b1773655e773cf7b77009cd653357a28e85cbe6dbf49ff5da4f839cb84600a47
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 | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"`; do echo ${x} ; done )
18
+ local nicknames=$(for x in `ppl nick --no-color | cut -d ':' -f 1`; do echo ${x} ; done )
19
19
  COMPREPLY=( $(compgen -W "${nicknames}" -- ${cur}) )
20
20
  return 0
21
21
  fi
data/completions/zsh CHANGED
@@ -2,7 +2,7 @@
2
2
  #autoload
3
3
 
4
4
  _ppl_contacts() {
5
- contacts=(`ppl nick | cut -d ':' -f 1 | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"`)
5
+ contacts=(`ppl nick --no-color | cut -d ':' -f 1`)
6
6
  }
7
7
 
8
8
  local -a _1st_arguments
@@ -27,6 +27,9 @@ class Ppl::Command::Attribute < Ppl::Application::Command
27
27
 
28
28
  def list_attribute(input, output)
29
29
  address_book = @storage.load_address_book
30
+ if input.options[:no_color]
31
+ @list_format.disable_colors!
32
+ end
30
33
  output.line(@list_format.process(address_book))
31
34
  true
32
35
  end
@@ -13,6 +13,9 @@ class Ppl::Command::Nick < Ppl::Command::Attribute
13
13
  parser.on("-d", "--delete", "delete nickname") do
14
14
  options[:delete] = true
15
15
  end
16
+ parser.on("--no-color", "turn off colored output") do
17
+ options[:no_color] = true
18
+ end
16
19
  end
17
20
 
18
21
  end
@@ -12,6 +12,9 @@ class Ppl::Format::AddressBook::Nicknames < Ppl::Format::AddressBook
12
12
  @table.to_s
13
13
  end
14
14
 
15
+ def disable_colors!
16
+ @table.disable_colors!
17
+ end
15
18
 
16
19
  private
17
20
 
@@ -38,6 +38,9 @@ class Ppl::Format::Table
38
38
  string.strip
39
39
  end
40
40
 
41
+ def disable_colors!
42
+ @colors = {}
43
+ end
41
44
 
42
45
  private
43
46
 
data/lib/ppl.rb CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  module Ppl
3
3
 
4
- Version = "1.19.0"
4
+ Version = "1.20.0"
5
5
 
6
6
  module Adapter
7
7
  end
data/ppl.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
  Gem::Specification.new do |spec|
3
3
 
4
4
  spec.name = "ppl"
5
- spec.version = "1.19.0"
5
+ spec.version = "1.20.0"
6
6
  spec.date = "2013-04-19"
7
7
 
8
8
  spec.required_ruby_version = ">= 1.9.3"
@@ -28,6 +28,15 @@ describe Ppl::Command::Attribute do
28
28
  @command.execute(@input, @output).should eq true
29
29
  end
30
30
 
31
+ it "should disable color output if :no_color is set" do
32
+ @input.options[:no_color] = true
33
+ @storage.stub(:load_address_book).and_return(@address_book)
34
+ @list_format.should_receive(:disable_colors!)
35
+ @list_format.stub(:process)
36
+ @output.should_receive(:line)
37
+ @command.execute(@input, @output).should eq true
38
+ end
39
+
31
40
  it "should show the full list of attributes for the given contact" do
32
41
  @input.arguments.push("jdoe")
33
42
  @storage.should_receive(:require_contact).and_return(@contact)
@@ -44,5 +44,12 @@ describe Ppl::Format::AddressBook::Nicknames do
44
44
 
45
45
  end
46
46
 
47
+ describe "#disable_colors!" do
48
+ it "should turn off the table's colors" do
49
+ @table.should_receive(:disable_colors!)
50
+ @format.disable_colors!
51
+ end
52
+ end
53
+
47
54
  end
48
55
 
@@ -98,5 +98,22 @@ describe Ppl::Format::Table do
98
98
 
99
99
  end
100
100
 
101
+ describe "#disable_colors!" do
102
+ it "should disable colors" do
103
+ @table.colors = {
104
+ "id" => "red",
105
+ "name" => "yellow",
106
+ "email" => "blue",
107
+ }
108
+ @table.add_row({
109
+ :id => 12345,
110
+ :name => "John Doe",
111
+ :email => "jdoe@example.org",
112
+ })
113
+ @table.disable_colors!
114
+ @table.to_s.should eq "12345 John Doe jdoe@example.org"
115
+ end
116
+ end
117
+
101
118
  end
102
119
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ppl
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.19.0
4
+ version: 1.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henry Smith