commander 4.4.1 → 4.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +29 -1
- data/History.rdoc +4 -0
- data/commander.gemspec +3 -1
- data/lib/commander/command.rb +1 -1
- data/lib/commander/runner.rb +5 -3
- data/lib/commander/user_interaction.rb +1 -1
- data/lib/commander/version.rb +1 -1
- data/spec/runner_spec.rb +17 -0
- data/spec/spec_helper.rb +1 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea8a3adb031f870cf34d2f8bc700fe79fdaa8dc1
|
4
|
+
data.tar.gz: 185b443d300a91265e8c5ccede6af243acb0001d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7591ef4b0a0f8b3843576a9c34a5d53dc0d10031fb8d22e95180c655b4d90ee05998c959f771f5334550c8781368201a6c89d5a81165ae15cca77d0226f9ff0f
|
7
|
+
data.tar.gz: 5ab3f6ec15fe1d6febfbc02395fe6b2f9985b273f30e699fa7b56fd2fa218c853855f054e92ed81db747e61e0ce15a7841cf14922c7ed6f39d8997e5b69ff6c8
|
data/.rubocop.yml
CHANGED
@@ -5,5 +5,33 @@ Encoding:
|
|
5
5
|
Enabled: false
|
6
6
|
|
7
7
|
# Enforce trailing comma after last item of multiline hashes.
|
8
|
-
Style/
|
8
|
+
Style/TrailingCommaInLiteral:
|
9
9
|
EnforcedStyleForMultiline: comma
|
10
|
+
|
11
|
+
Metrics/BlockLength:
|
12
|
+
Enabled: false
|
13
|
+
|
14
|
+
Style/SignalException:
|
15
|
+
EnforcedStyle: only_fail
|
16
|
+
|
17
|
+
Style/ParallelAssignment:
|
18
|
+
Enabled: false
|
19
|
+
|
20
|
+
Style/NumericLiteralPrefix:
|
21
|
+
EnforcedOctalStyle: zero_only
|
22
|
+
|
23
|
+
Style/MethodMissing:
|
24
|
+
Enabled: false
|
25
|
+
|
26
|
+
Style/SpaceInsideStringInterpolation:
|
27
|
+
Enabled: false
|
28
|
+
|
29
|
+
Style/MultilineOperationIndentation:
|
30
|
+
Enabled: false
|
31
|
+
|
32
|
+
Style/EmptyMethod:
|
33
|
+
EnforcedStyle: expanded
|
34
|
+
|
35
|
+
Metrics/ModuleLength:
|
36
|
+
CountComments: false # count full line comments?
|
37
|
+
Max: 150
|
data/History.rdoc
CHANGED
data/commander.gemspec
CHANGED
@@ -22,8 +22,10 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.add_development_dependency('rspec', '~> 3.2')
|
23
23
|
s.add_development_dependency('rake')
|
24
24
|
s.add_development_dependency('simplecov')
|
25
|
-
s.add_development_dependency('rubocop', '~> 0.29.1')
|
26
25
|
if RUBY_VERSION < '2.0'
|
26
|
+
s.add_development_dependency('rubocop', '~> 0.41.1')
|
27
27
|
s.add_development_dependency('json', '< 2.0')
|
28
|
+
else
|
29
|
+
s.add_development_dependency('rubocop', '~> 0.46')
|
28
30
|
end
|
29
31
|
end
|
data/lib/commander/command.rb
CHANGED
@@ -140,7 +140,7 @@ module Commander
|
|
140
140
|
fail ArgumentError, 'must pass an object, class, or block.' if args.empty? && !block
|
141
141
|
@when_called = block ? [block] : args
|
142
142
|
end
|
143
|
-
|
143
|
+
alias action when_called
|
144
144
|
|
145
145
|
##
|
146
146
|
# Run the command with _args_.
|
data/lib/commander/runner.rb
CHANGED
@@ -134,6 +134,7 @@ module Commander
|
|
134
134
|
# :name Program name, defaults to basename of executable
|
135
135
|
# :help_formatter Defaults to Commander::HelpFormatter::Terminal
|
136
136
|
# :help Allows addition of arbitrary global help blocks
|
137
|
+
# :help_paging Flag for toggling help paging
|
137
138
|
# :int_message Message to display when interrupted (CTRL + C)
|
138
139
|
#
|
139
140
|
|
@@ -147,7 +148,7 @@ module Commander
|
|
147
148
|
@program[key] = block
|
148
149
|
else
|
149
150
|
unless args.empty?
|
150
|
-
@program[key] =
|
151
|
+
@program[key] = args.count == 1 ? args[0] : args
|
151
152
|
end
|
152
153
|
@program[key]
|
153
154
|
end
|
@@ -246,7 +247,7 @@ module Commander
|
|
246
247
|
|
247
248
|
def valid_command_names_from(*args)
|
248
249
|
arg_string = args.delete_if { |value| value =~ /^-/ }.join ' '
|
249
|
-
commands.keys.find_all { |name| name if /^#{name}\b
|
250
|
+
commands.keys.find_all { |name| name if arg_string =~ /^#{name}\b/ }
|
250
251
|
end
|
251
252
|
|
252
253
|
##
|
@@ -283,6 +284,7 @@ module Commander
|
|
283
284
|
{
|
284
285
|
help_formatter: HelpFormatter::Terminal,
|
285
286
|
name: File.basename($PROGRAM_NAME),
|
287
|
+
help_paging: true,
|
286
288
|
}
|
287
289
|
end
|
288
290
|
|
@@ -297,7 +299,7 @@ module Commander
|
|
297
299
|
c.example 'Display global help', 'command help'
|
298
300
|
c.example "Display help for 'foo'", 'command help foo'
|
299
301
|
c.when_called do |args, _options|
|
300
|
-
UI.enable_paging
|
302
|
+
UI.enable_paging if program(:help_paging)
|
301
303
|
if args.empty?
|
302
304
|
say help_formatter.render
|
303
305
|
else
|
data/lib/commander/version.rb
CHANGED
data/spec/runner_spec.rb
CHANGED
@@ -407,6 +407,23 @@ describe Commander do
|
|
407
407
|
it 'can be used before or after the command and options' do
|
408
408
|
expect(run('test', '--help')).to eq("Implement help for test here\n")
|
409
409
|
end
|
410
|
+
|
411
|
+
describe 'help_paging program information' do
|
412
|
+
it 'enables paging when enabled' do
|
413
|
+
run('--help') { program :help_paging, true }
|
414
|
+
expect(Commander::UI).to have_received(:enable_paging)
|
415
|
+
end
|
416
|
+
|
417
|
+
it 'is enabled by default' do
|
418
|
+
run('--help')
|
419
|
+
expect(Commander::UI).to have_received(:enable_paging)
|
420
|
+
end
|
421
|
+
|
422
|
+
it 'does not enable paging when disabled' do
|
423
|
+
run('--help') { program :help_paging, false }
|
424
|
+
expect(Commander::UI).not_to have_received(:enable_paging)
|
425
|
+
end
|
426
|
+
end
|
410
427
|
end
|
411
428
|
|
412
429
|
describe 'with invalid options' do
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: commander
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.4.
|
4
|
+
version: 4.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TJ Holowaychuk
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-12-
|
12
|
+
date: 2016-12-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: highline
|
@@ -73,14 +73,14 @@ dependencies:
|
|
73
73
|
requirements:
|
74
74
|
- - "~>"
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version: 0.
|
76
|
+
version: '0.46'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
81
|
- - "~>"
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version: 0.
|
83
|
+
version: '0.46'
|
84
84
|
description: The complete solution for Ruby command-line executables. Commander bridges
|
85
85
|
the gap between other terminal related libraries you know and love (OptionParser,
|
86
86
|
HighLine), while providing many new features, and an elegant API.
|