choosy 0.4.8 → 0.4.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
choosy (0.4.
|
4
|
+
choosy (0.4.8)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: http://rubygems.org/
|
@@ -25,8 +25,8 @@ PLATFORMS
|
|
25
25
|
ruby
|
26
26
|
|
27
27
|
DEPENDENCIES
|
28
|
-
ZenTest
|
28
|
+
ZenTest
|
29
29
|
autotest
|
30
30
|
autotest-notification
|
31
31
|
choosy!
|
32
|
-
rspec
|
32
|
+
rspec
|
data/lib/VERSION.yml
CHANGED
@@ -74,11 +74,19 @@ module Choosy::Printing
|
|
74
74
|
|
75
75
|
protected
|
76
76
|
def highlight_begin
|
77
|
-
@highlight_begin ||= color.
|
77
|
+
@highlight_begin ||= if color.disabled?
|
78
|
+
''
|
79
|
+
else
|
80
|
+
color.multiple(nil, option_styles)
|
81
|
+
end
|
78
82
|
end
|
79
83
|
|
80
84
|
def highlight_end
|
81
|
-
color.
|
85
|
+
if color.disabled?
|
86
|
+
''
|
87
|
+
else
|
88
|
+
color.reset
|
89
|
+
end
|
82
90
|
end
|
83
91
|
|
84
92
|
def nl
|
data/lib/choosy/super_parser.rb
CHANGED
@@ -52,8 +52,6 @@ module Choosy
|
|
52
52
|
end
|
53
53
|
|
54
54
|
def parse_globals(args)
|
55
|
-
count = args.count
|
56
|
-
|
57
55
|
result = SuperParseResult.new(@super_command)
|
58
56
|
parser = Parser.new(@super_command, true, [])
|
59
57
|
parser.parse!(args, result)
|
@@ -61,7 +59,7 @@ module Choosy
|
|
61
59
|
|
62
60
|
# if we found a global action, we should have hit it by now...
|
63
61
|
if result.unparsed.length == 0
|
64
|
-
if
|
62
|
+
if @super_command.has_default?
|
65
63
|
result.unparsed << @super_command.default_command.to_s
|
66
64
|
elsif @super_command.command_builders[Choosy::DSL::SuperCommandBuilder::HELP]
|
67
65
|
raise Choosy::HelpCalled.new(Choosy::DSL::SuperCommandBuilder::SUPER)
|
@@ -106,5 +106,14 @@ module Choosy::Printing
|
|
106
106
|
whole screen at least once, so that I can test whether it's
|
107
107
|
properly formatted\n")
|
108
108
|
end
|
109
|
+
|
110
|
+
it "should format a regular option with color, when not disabled" do
|
111
|
+
@h.regular_option(@c.listing[5]).should eql(" \e[1m--count\e[0m COUNT")
|
112
|
+
end
|
113
|
+
|
114
|
+
it "should format a regular option without color when color is disabled" do
|
115
|
+
@h.color.disable!
|
116
|
+
@h.regular_option(@c.listing[5]).should eql(" --count COUNT")
|
117
|
+
end
|
109
118
|
end
|
110
119
|
end
|
@@ -5,9 +5,11 @@ describe "SuperCommand C" do
|
|
5
5
|
class SuperCommandC
|
6
6
|
def super_command
|
7
7
|
Choosy::SuperCommand.new :super do
|
8
|
+
default :subA
|
8
9
|
|
9
10
|
command subA
|
10
11
|
command subB
|
12
|
+
command :help
|
11
13
|
|
12
14
|
boolean :option, "Option" do
|
13
15
|
desc option_name
|
@@ -33,13 +35,19 @@ describe "SuperCommand C" do
|
|
33
35
|
end
|
34
36
|
end
|
35
37
|
|
38
|
+
before :each do
|
39
|
+
@sup = SuperCommandC.new.super_command
|
40
|
+
end
|
41
|
+
|
36
42
|
it "should set the option name correctly" do
|
37
|
-
sup
|
38
|
-
sup.option_builders[:option].entity.description.should eql("an option name")
|
43
|
+
@sup.option_builders[:option].entity.description.should eql("an option name")
|
39
44
|
end
|
40
45
|
|
41
46
|
it "should set the sub-option name correctly" do
|
42
|
-
sup
|
43
|
-
|
47
|
+
@sup.command_builders[:subA].entity.option_builders[:sub_option].entity.description.should eql("an option name")
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should return the default command on parse" do
|
51
|
+
@sup.parse!(['-o'], true).subresults[0].command.name.should eql(:subA)
|
44
52
|
end
|
45
53
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 4
|
8
|
-
-
|
9
|
-
version: 0.4.
|
8
|
+
- 9
|
9
|
+
version: 0.4.9
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Gabe McArthur
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-
|
17
|
+
date: 2011-04-07 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|