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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6f99aeb41258777769c560127ccfc168d2c673e1
4
- data.tar.gz: e374077ade7007619a37e26bb587c0d7be336df6
3
+ metadata.gz: ea8a3adb031f870cf34d2f8bc700fe79fdaa8dc1
4
+ data.tar.gz: 185b443d300a91265e8c5ccede6af243acb0001d
5
5
  SHA512:
6
- metadata.gz: 75c44b69d218b6843b2c30a1ee8ebeadb9867d797323bcd00c261628005b1c772c3990a16d78df93dc5494bd099ea04af7027ccaa81026b920b8c29a5440b795
7
- data.tar.gz: b1e6fb8f2aa3bdccffb093aa49c107d37370106638b9a12f04f9a8320ce5e597fd3044834b941c5556128cca82bfe1e0ad5048d1a159f7b12617b75f05df6995
6
+ metadata.gz: 7591ef4b0a0f8b3843576a9c34a5d53dc0d10031fb8d22e95180c655b4d90ee05998c959f771f5334550c8781368201a6c89d5a81165ae15cca77d0226f9ff0f
7
+ data.tar.gz: 5ab3f6ec15fe1d6febfbc02395fe6b2f9985b273f30e699fa7b56fd2fa218c853855f054e92ed81db747e61e0ce15a7841cf14922c7ed6f39d8997e5b69ff6c8
@@ -5,5 +5,33 @@ Encoding:
5
5
  Enabled: false
6
6
 
7
7
  # Enforce trailing comma after last item of multiline hashes.
8
- Style/TrailingComma:
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
@@ -1,3 +1,7 @@
1
+ === 4.4.2 / 2016-12-20
2
+
3
+ * Add `help_paging` program flag so that help paging may be disabled. (@gogiel)
4
+
1
5
  === 4.4.1 / 2016-12-02
2
6
 
3
7
  * Fix #36 - Warning about MissingSourceFile (@fallwith)
@@ -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
@@ -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
- alias_method :action, :when_called
143
+ alias action when_called
144
144
 
145
145
  ##
146
146
  # Run the command with _args_.
@@ -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] = (args.count == 1 && args[0]) || args
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/.match arg_string }
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
@@ -181,7 +181,7 @@ module Commander
181
181
  #{statement}
182
182
  end if
183
183
  end tell
184
- ),
184
+ )
185
185
  ).strip.to_sym
186
186
  end
187
187
 
@@ -1,3 +1,3 @@
1
1
  module Commander
2
- VERSION = '4.4.1'
2
+ VERSION = '4.4.2'.freeze
3
3
  end
@@ -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
@@ -58,6 +58,7 @@ end
58
58
  def run(*args)
59
59
  new_command_runner(*args) do
60
60
  program :help_formatter, Commander::HelpFormatter::Base
61
+ yield if block_given?
61
62
  end.run!
62
63
  @output.string
63
64
  end
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.1
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-02 00:00:00.000000000 Z
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.29.1
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.29.1
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.