gli 2.5.4 → 2.5.5
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 +1 -1
- data/README.rdoc +1 -0
- data/lib/gli/commands/doc.rb +1 -1
- data/lib/gli/commands/help_modules/command_help_format.rb +1 -1
- data/lib/gli/commands/rdoc_document_listener.rb +2 -2
- data/lib/gli/switch.rb +1 -1
- data/lib/gli/version.rb +1 -1
- data/test/tc_gli.rb +1 -1
- data/test/tc_help.rb +28 -0
- metadata +5 -5
data/Gemfile
CHANGED
data/README.rdoc
CHANGED
data/lib/gli/commands/doc.rb
CHANGED
@@ -103,7 +103,7 @@ COMMANDS
|
|
103
103
|
def format_subcommands(command)
|
104
104
|
commands_array = @sorter.call(command.commands_declaration_order).map { |cmd|
|
105
105
|
if command.get_default_command == cmd.name
|
106
|
-
[cmd.names,cmd.description + " (default)"]
|
106
|
+
[cmd.names,String(cmd.description) + " (default)"]
|
107
107
|
else
|
108
108
|
[cmd.names,cmd.description]
|
109
109
|
end
|
@@ -58,8 +58,8 @@ module GLI
|
|
58
58
|
end
|
59
59
|
|
60
60
|
# Gives you a switch in the current context
|
61
|
-
def switch(name,aliases,desc,long_desc,
|
62
|
-
if
|
61
|
+
def switch(name,aliases,desc,long_desc,negatable)
|
62
|
+
if negatable
|
63
63
|
name = "[no-]#{name}" if name.to_s.length > 1
|
64
64
|
aliases = aliases.map { |_| _.to_s.length > 1 ? "[no-]#{_}" : _ }
|
65
65
|
end
|
data/lib/gli/switch.rb
CHANGED
@@ -20,7 +20,7 @@ module GLI
|
|
20
20
|
@default_value = false if options[:default_value].nil?
|
21
21
|
@negatable = options[:negatable].nil? ? true : options[:negatable]
|
22
22
|
if @default_value != false && @negatable == false
|
23
|
-
raise "A switch with default #{@default_value} that isn't
|
23
|
+
raise "A switch with default #{@default_value} that isn't negatable is useless"
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
data/lib/gli/version.rb
CHANGED
data/test/tc_gli.rb
CHANGED
@@ -448,7 +448,7 @@ class TC_testGLI < Clean::Test::TestCase
|
|
448
448
|
assert @switch_value == false,"Got: '#{@switch_value}', but expected false"
|
449
449
|
end
|
450
450
|
|
451
|
-
def
|
451
|
+
def test_switch_with_default_true_and_not_negatable_causes_exception
|
452
452
|
@app.reset
|
453
453
|
@app.on_error do |ex|
|
454
454
|
raise ex
|
data/test/tc_help.rb
CHANGED
@@ -151,6 +151,34 @@ class TC_testHelp < Clean::Test::TestCase
|
|
151
151
|
}
|
152
152
|
end
|
153
153
|
|
154
|
+
test_that "omitting default_description doesn't blow up" do
|
155
|
+
Given {
|
156
|
+
app = TestApp.new
|
157
|
+
app.instance_eval do
|
158
|
+
command :top do |top|
|
159
|
+
top.command :list do |list|
|
160
|
+
list.action do |g,o,a|
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
top.command :new do |new|
|
165
|
+
new.action do |g,o,a|
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
top.default_command :list
|
170
|
+
end
|
171
|
+
end
|
172
|
+
@command = GLI::Commands::Help.new(app,@output,@error)
|
173
|
+
}
|
174
|
+
When {
|
175
|
+
@code = lambda { @command.execute({},{},['top']) }
|
176
|
+
}
|
177
|
+
Then {
|
178
|
+
assert_nothing_raised(&@code)
|
179
|
+
}
|
180
|
+
end
|
181
|
+
|
154
182
|
private
|
155
183
|
|
156
184
|
def a_GLI_app(omit_options=false)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.5.
|
4
|
+
version: 2.5.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-03-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -333,7 +333,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
333
333
|
version: '0'
|
334
334
|
segments:
|
335
335
|
- 0
|
336
|
-
hash:
|
336
|
+
hash: 4280558449703188921
|
337
337
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
338
338
|
none: false
|
339
339
|
requirements:
|
@@ -342,10 +342,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
342
342
|
version: '0'
|
343
343
|
segments:
|
344
344
|
- 0
|
345
|
-
hash:
|
345
|
+
hash: 4280558449703188921
|
346
346
|
requirements: []
|
347
347
|
rubyforge_project: gli
|
348
|
-
rubygems_version: 1.8.
|
348
|
+
rubygems_version: 1.8.25
|
349
349
|
signing_key:
|
350
350
|
specification_version: 3
|
351
351
|
summary: Build command-suite CLI apps that are awesome.
|