cri 2.7.0 → 2.7.1

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.
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  module Cri
4
2
  module CoreExtensions
5
3
  end
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  require 'colored'
4
2
 
5
3
  module Cri
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  module Cri
4
2
  # The {HelpRenderer} class is responsible for generating a string containing
5
3
  # the help for a given command, intended to be printed on the command line.
@@ -86,22 +84,21 @@ module Cri
86
84
  length = shown_subcommands.map { |c| fmt.format_as_command(c.name, @io).size }.max
87
85
 
88
86
  # Command
89
- shown_subcommands.sort_by { |cmd| cmd.name }.each do |cmd|
87
+ shown_subcommands.sort_by(&:name).each do |cmd|
90
88
  text <<
91
89
  format(
92
90
  " %-#{length + DESC_INDENT}s %s\n",
93
91
  fmt.format_as_command(cmd.name, @io),
94
- cmd.summary)
92
+ cmd.summary,
93
+ )
95
94
  end
96
95
 
97
96
  # Hidden notice
98
97
  unless @is_verbose
99
98
  diff = @cmd.subcommands.size - shown_subcommands.size
100
- case diff
101
- when 0
102
- when 1
99
+ if diff == 1
103
100
  text << " (1 hidden command omitted; show it with --verbose)\n"
104
- else
101
+ elsif diff > 1
105
102
  text << " (#{diff} hidden commands omitted; show them with --verbose)\n"
106
103
  end
107
104
  end
@@ -145,7 +142,7 @@ module Cri
145
142
  return if defs.empty?
146
143
 
147
144
  text << "\n"
148
- text << fmt.format_as_title("#{name}", @io)
145
+ text << fmt.format_as_title(name.to_s, @io)
149
146
  text << "\n"
150
147
 
151
148
  ordered_defs = defs.sort_by { |x| x[:short] || x[:long] }
@@ -164,8 +161,6 @@ module Cri
164
161
  '<value>'
165
162
  when :optional
166
163
  '[<value>]'
167
- else
168
- nil
169
164
  end
170
165
 
171
166
  if value_postfix
@@ -182,8 +177,6 @@ module Cri
182
177
  '=<value>'
183
178
  when :optional
184
179
  '[=<value>]'
185
- else
186
- nil
187
180
  end
188
181
 
189
182
  if value_postfix
@@ -1,7 +1,5 @@
1
- # encoding: utf-8
2
-
3
1
  module Cri
4
- # Cri::OptionParser is used for parsing commandline options.
2
+ # Cri::OptionParser is used for parsing command-line options.
5
3
  #
6
4
  # Option definitions are hashes with the keys `:short`, `:long` and
7
5
  # `:argument` (optionally `:description` but this is not used by the
@@ -19,7 +17,7 @@ module Cri
19
17
  # { :short => 'p', :long => 'port', :argument => :required, :multiple => false },
20
18
  # ]
21
19
  #
22
- # For example, the following commandline options (which should not be
20
+ # For example, the following command-line options (which should not be
23
21
  # passed as a string, but as an array of strings):
24
22
  #
25
23
  # foo -xyz -a hiss -s -m please --level 50 --father=ani -n luke squeak
@@ -92,11 +90,11 @@ module Cri
92
90
  # @return [Array] The not yet parsed options and arguments.
93
91
  attr_reader :unprocessed_arguments_and_options
94
92
 
95
- # Parses the commandline arguments. See the instance `parse` method for
93
+ # Parses the command-line arguments. See the instance `parse` method for
96
94
  # details.
97
95
  #
98
96
  # @param [Array<String>] arguments_and_options An array containing the
99
- # commandline arguments (will probably be `ARGS` for a root command)
97
+ # command-line arguments (will probably be `ARGS` for a root command)
100
98
  #
101
99
  # @param [Array<Hash>] definitions An array of option definitions
102
100
  #
@@ -108,7 +106,7 @@ module Cri
108
106
  # Creates a new parser with the given options/arguments and definitions.
109
107
  #
110
108
  # @param [Array<String>] arguments_and_options An array containing the
111
- # commandline arguments (will probably be `ARGS` for a root command)
109
+ # command-line arguments (will probably be `ARGS` for a root command)
112
110
  #
113
111
  # @param [Array<Hash>] definitions An array of option definitions
114
112
  def initialize(arguments_and_options, definitions)
@@ -146,7 +144,7 @@ module Cri
146
144
  @running = false
147
145
  end
148
146
 
149
- # Parses the commandline arguments into options and arguments.
147
+ # Parses the command-line arguments into options and arguments.
150
148
  #
151
149
  # During parsing, two errors can be raised:
152
150
  #
@@ -199,7 +197,7 @@ module Cri
199
197
 
200
198
  # Find definition
201
199
  definition = @definitions.find { |d| d[:long] == option_key }
202
- fail IllegalOptionError.new(option_key) if definition.nil?
200
+ raise IllegalOptionError.new(option_key) if definition.nil?
203
201
 
204
202
  if [:required, :optional].include?(definition[:argument])
205
203
  # Get option value if necessary
@@ -223,11 +221,11 @@ module Cri
223
221
  option_keys.each do |option_key|
224
222
  # Find definition
225
223
  definition = @definitions.find { |d| d[:short] == option_key }
226
- fail IllegalOptionError.new(option_key) if definition.nil?
224
+ raise IllegalOptionError.new(option_key) if definition.nil?
227
225
 
228
226
  if option_keys.length > 1 && definition[:argument] == :required
229
227
  # This is a combined option and it requires an argument, so complain
230
- fail OptionRequiresAnArgumentError.new(option_key)
228
+ raise OptionRequiresAnArgumentError.new(option_key)
231
229
  elsif [:required, :optional].include?(definition[:argument])
232
230
  # Get option value
233
231
  option_value = find_option_value(definition, option_key)
@@ -245,7 +243,7 @@ module Cri
245
243
  option_value = @unprocessed_arguments_and_options.shift
246
244
  if option_value.nil? || option_value =~ /^-/
247
245
  if definition[:argument] == :required
248
- fail OptionRequiresAnArgumentError.new(option_key)
246
+ raise OptionRequiresAnArgumentError.new(option_key)
249
247
  else
250
248
  @unprocessed_arguments_and_options.unshift(option_value)
251
249
  option_value = true
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  module Cri
4
2
  module Platform
5
3
  # @return [Boolean] true if the current platform is Windows, false
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  require 'colored'
4
2
 
5
3
  module Cri
@@ -21,7 +19,7 @@ module Cri
21
19
  end
22
20
  end
23
21
 
24
- paragraphs.reject { |p| p.empty? }.map { |p| p.join(' ') }
22
+ paragraphs.reject(&:empty?).map { |p| p.join(' ') }
25
23
  end
26
24
 
27
25
  # Word-wraps and indents the string.
@@ -1,6 +1,4 @@
1
- # encoding: utf-8
2
-
3
1
  module Cri
4
2
  # The current Cri version.
5
- VERSION = '2.7.0'
3
+ VERSION = '2.7.1'.freeze
6
4
  end
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  require 'coveralls'
4
2
  Coveralls.wear!
5
3
 
@@ -20,16 +18,16 @@ module Cri
20
18
  uncapture_io(*@orig_io)
21
19
  end
22
20
 
23
- def capture_io_while(&block)
21
+ def capture_io_while
24
22
  orig_io = capture_io
25
- block.call
23
+ yield
26
24
  [$stdout.string, $stderr.string]
27
25
  ensure
28
26
  uncapture_io(*orig_io)
29
27
  end
30
28
 
31
29
  def lines(string)
32
- string.scan(/^.*\n/).map { |s| s.chomp }
30
+ string.scan(/^.*\n/).map(&:chomp)
33
31
  end
34
32
 
35
33
  private
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  module Cri
4
2
  class ArgumentArrayTestCase < Cri::TestCase
5
3
  def test_initialize
@@ -1,8 +1,5 @@
1
- # encoding: utf-8
2
-
3
1
  module Cri
4
2
  class BaseTestCase < Cri::TestCase
5
- def test_stub
6
- end
3
+ def test_stub; end
7
4
  end
8
5
  end
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  module Cri
4
2
  class BasicHelpTestCase < Cri::TestCase
5
3
  def test_run_without_supercommand
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  module Cri
4
2
  class BasicRootTestCase < Cri::TestCase
5
3
  def test_run_with_help
@@ -7,7 +5,7 @@ module Cri
7
5
 
8
6
  stdout, _stderr = capture_io_while do
9
7
  assert_raises SystemExit do
10
- cmd.run(%w( -h ))
8
+ cmd.run(%w(-h))
11
9
  end
12
10
  end
13
11
 
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  module Cri
4
2
  class CommandTestCase < Cri::TestCase
5
3
  def simple_cmd
@@ -9,7 +7,7 @@ module Cri
9
7
  summary 'does stuff'
10
8
  description 'This command does a lot of stuff.'
11
9
 
12
- option :a, :aaa, 'opt a', :argument => :optional do |value, cmd|
10
+ option :a, :aaa, 'opt a', argument: :optional do |value, cmd|
13
11
  $stdout.puts "#{cmd.name}:#{value}"
14
12
  end
15
13
  required :b, :bbb, 'opt b'
@@ -31,7 +29,7 @@ module Cri
31
29
 
32
30
  def bare_cmd
33
31
  Cri::Command.define do
34
- name 'moo'
32
+ name 'moo'
35
33
 
36
34
  run do |_opts, _args|
37
35
  end
@@ -45,7 +43,7 @@ module Cri
45
43
  summary 'does super stuff'
46
44
  description 'This command does super stuff.'
47
45
 
48
- option :a, :aaa, 'opt a', :argument => :optional do |value, cmd|
46
+ option :a, :aaa, 'opt a', argument: :optional do |value, cmd|
49
47
  $stdout.puts "#{cmd.name}:#{value}"
50
48
  end
51
49
  required :b, :bbb, 'opt b'
@@ -61,7 +59,7 @@ module Cri
61
59
  summary 'does subby stuff'
62
60
  description 'This command does subby stuff.'
63
61
 
64
- option :m, :mmm, 'opt m', :argument => :optional
62
+ option :m, :mmm, 'opt m', argument: :optional
65
63
  required :n, :nnn, 'opt n'
66
64
  optional :o, :ooo, 'opt o'
67
65
  flag :p, :ppp, 'opt p'
@@ -148,7 +146,7 @@ module Cri
148
146
  def test_invoke_simple_with_missing_opt_arg
149
147
  out, err = capture_io_while do
150
148
  assert_raises SystemExit do
151
- simple_cmd.run(%w( -b ))
149
+ simple_cmd.run(%w(-b))
152
150
  end
153
151
  end
154
152
 
@@ -159,7 +157,7 @@ module Cri
159
157
  def test_invoke_simple_with_illegal_opt
160
158
  out, err = capture_io_while do
161
159
  assert_raises SystemExit do
162
- simple_cmd.run(%w( -z ))
160
+ simple_cmd.run(%w(-z))
163
161
  end
164
162
  end
165
163
 
@@ -169,7 +167,7 @@ module Cri
169
167
 
170
168
  def test_invoke_simple_with_opt_with_block
171
169
  out, err = capture_io_while do
172
- simple_cmd.run(%w( -a 123 ))
170
+ simple_cmd.run(%w(-a 123))
173
171
  end
174
172
 
175
173
  assert_equal ['moo:123', 'Awesome moo!', '', 'aaa=123'], lines(out)
@@ -189,7 +187,7 @@ module Cri
189
187
 
190
188
  def test_invoke_nested_with_correct_command_name
191
189
  out, err = capture_io_while do
192
- nested_cmd.run(%w( sub ))
190
+ nested_cmd.run(%w(sub))
193
191
  end
194
192
 
195
193
  assert_equal ['Sub-awesome!', '', ''], lines(out)
@@ -199,7 +197,7 @@ module Cri
199
197
  def test_invoke_nested_with_incorrect_command_name
200
198
  out, err = capture_io_while do
201
199
  assert_raises SystemExit do
202
- nested_cmd.run(%w( oogabooga ))
200
+ nested_cmd.run(%w(oogabooga))
203
201
  end
204
202
  end
205
203
 
@@ -210,7 +208,7 @@ module Cri
210
208
  def test_invoke_nested_with_ambiguous_command_name
211
209
  out, err = capture_io_while do
212
210
  assert_raises SystemExit do
213
- nested_cmd.run(%w( s ))
211
+ nested_cmd.run(%w(s))
214
212
  end
215
213
  end
216
214
 
@@ -220,7 +218,7 @@ module Cri
220
218
 
221
219
  def test_invoke_nested_with_alias
222
220
  out, err = capture_io_while do
223
- nested_cmd.run(%w( sup ))
221
+ nested_cmd.run(%w(sup))
224
222
  end
225
223
 
226
224
  assert_equal ['Sub-awesome!', '', ''], lines(out)
@@ -229,7 +227,7 @@ module Cri
229
227
 
230
228
  def test_invoke_nested_with_options_before_command
231
229
  out, err = capture_io_while do
232
- nested_cmd.run(%w( -a 666 sub ))
230
+ nested_cmd.run(%w(-a 666 sub))
233
231
  end
234
232
 
235
233
  assert_equal ['super:666', 'Sub-awesome!', '', 'aaa=666'], lines(out)
@@ -245,7 +243,7 @@ module Cri
245
243
  assert_equal [], lines(err)
246
244
 
247
245
  out, err = capture_io_while do
248
- nested_cmd_with_run_block.run(%w( sub ))
246
+ nested_cmd_with_run_block.run(%w(sub))
249
247
  end
250
248
 
251
249
  assert_equal ['sub'], lines(out)
@@ -354,7 +352,7 @@ module Cri
354
352
  def test_help_with_multiple_groups
355
353
  help = nested_cmd.subcommands.find { |cmd| cmd.name == 'sub' }.help
356
354
 
357
- assert_match(/OPTIONS.*OPTIONS FOR SUPER/m, help)
355
+ assert_match(/OPTIONS.*OPTIONS FOR SUPER/m, help)
358
356
  end
359
357
 
360
358
  def test_modify_with_block_argument
@@ -377,7 +375,7 @@ module Cri
377
375
 
378
376
  cmd = Cri::Command.define do
379
377
  name 'build'
380
- flag nil, :longflag, 'This is an option with a very long description that should be wrapped'
378
+ flag nil, :longflag, 'This is an option with a very long description that should be wrapped'
381
379
  end
382
380
  help = cmd.help
383
381
 
@@ -469,9 +467,9 @@ module Cri
469
467
  assert cmd.help.include?('hidden command omitted')
470
468
  refute cmd.help.include?('old-and-deprecated')
471
469
 
472
- refute cmd.help(:verbose => true).include?('hidden commands omitted')
473
- refute cmd.help(:verbose => true).include?('hidden command omitted')
474
- assert cmd.help(:verbose => true).include?('old-and-deprecated')
470
+ refute cmd.help(verbose: true).include?('hidden commands omitted')
471
+ refute cmd.help(verbose: true).include?('hidden command omitted')
472
+ assert cmd.help(verbose: true).include?('old-and-deprecated')
475
473
  end
476
474
 
477
475
  def test_hidden_commands_multiple
@@ -505,13 +503,13 @@ module Cri
505
503
  refute cmd.help.include?('old-and-deprecated')
506
504
  refute cmd.help.include?('ancient-and-deprecated')
507
505
 
508
- refute cmd.help(:verbose => true).include?('hidden commands omitted')
509
- refute cmd.help(:verbose => true).include?('hidden command omitted')
510
- assert cmd.help(:verbose => true).include?('old-and-deprecated')
511
- assert cmd.help(:verbose => true).include?('ancient-and-deprecated')
506
+ refute cmd.help(verbose: true).include?('hidden commands omitted')
507
+ refute cmd.help(verbose: true).include?('hidden command omitted')
508
+ assert cmd.help(verbose: true).include?('old-and-deprecated')
509
+ assert cmd.help(verbose: true).include?('ancient-and-deprecated')
512
510
 
513
511
  pattern = /ancient-and-deprecated.*first.*old-and-deprecated/m
514
- assert_match(pattern, cmd.help(:verbose => true))
512
+ assert_match(pattern, cmd.help(verbose: true))
515
513
  end
516
514
 
517
515
  def test_run_with_raw_args
@@ -523,7 +521,7 @@ module Cri
523
521
  end
524
522
 
525
523
  out, _err = capture_io_while do
526
- cmd.run(%w( foo -- bar ))
524
+ cmd.run(%w(foo -- bar))
527
525
  end
528
526
  assert_equal "args=foo,bar args.raw=foo,--,bar\n", out
529
527
  end
@@ -549,7 +547,7 @@ module Cri
549
547
  end
550
548
 
551
549
  out, _err = capture_io_while do
552
- cmd.run(%w( foo -- bar ))
550
+ cmd.run(%w(foo -- bar))
553
551
  end
554
552
  assert_equal "args=foo,bar args.raw=foo,--,bar\n", out
555
553
  end
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  module Cri
4
2
  class CommandDSLTestCase < Cri::TestCase
5
3
  def test_create_command
@@ -11,12 +9,12 @@ module Cri
11
9
  summary 'does stuff'
12
10
  description 'This command does a lot of stuff.'
13
11
 
14
- option :a, :aaa, 'opt a', :argument => :optional, :multiple => true
12
+ option :a, :aaa, 'opt a', argument: :optional, multiple: true
15
13
  required :b, :bbb, 'opt b'
16
14
  optional :c, :ccc, 'opt c'
17
15
  flag :d, :ddd, 'opt d'
18
16
  forbidden :e, :eee, 'opt e'
19
- flag :f, :fff, 'opt f', :hidden => true
17
+ flag :f, :fff, 'opt f', hidden: true
20
18
 
21
19
  run do |_opts, _args|
22
20
  $did_it_work = :probably
@@ -26,7 +24,7 @@ module Cri
26
24
 
27
25
  # Run
28
26
  $did_it_work = :sadly_not
29
- command.run(%w( -a x -b y -c -d -e ))
27
+ command.run(%w(-a x -b y -c -d -e))
30
28
  assert_equal :probably, $did_it_work
31
29
 
32
30
  # Check
@@ -37,13 +35,13 @@ module Cri
37
35
 
38
36
  # Check options
39
37
  expected_option_definitions = Set.new([
40
- { :short => 'a', :long => 'aaa', :desc => 'opt a', :argument => :optional, :multiple => true, :hidden => false, :block => nil },
41
- { :short => 'b', :long => 'bbb', :desc => 'opt b', :argument => :required, :multiple => false, :hidden => false, :block => nil },
42
- { :short => 'c', :long => 'ccc', :desc => 'opt c', :argument => :optional, :multiple => false, :hidden => false, :block => nil },
43
- { :short => 'd', :long => 'ddd', :desc => 'opt d', :argument => :forbidden, :multiple => false, :hidden => false, :block => nil },
44
- { :short => 'e', :long => 'eee', :desc => 'opt e', :argument => :forbidden, :multiple => false, :hidden => false, :block => nil },
45
- { :short => 'f', :long => 'fff', :desc => 'opt f', :argument => :forbidden, :multiple => false, :hidden => true, :block => nil },
46
- ])
38
+ { short: 'a', long: 'aaa', desc: 'opt a', argument: :optional, multiple: true, hidden: false, block: nil },
39
+ { short: 'b', long: 'bbb', desc: 'opt b', argument: :required, multiple: false, hidden: false, block: nil },
40
+ { short: 'c', long: 'ccc', desc: 'opt c', argument: :optional, multiple: false, hidden: false, block: nil },
41
+ { short: 'd', long: 'ddd', desc: 'opt d', argument: :forbidden, multiple: false, hidden: false, block: nil },
42
+ { short: 'e', long: 'eee', desc: 'opt e', argument: :forbidden, multiple: false, hidden: false, block: nil },
43
+ { short: 'f', long: 'fff', desc: 'opt f', argument: :forbidden, multiple: false, hidden: true, block: nil },
44
+ ])
47
45
  actual_option_definitions = Set.new(command.option_definitions)
48
46
  assert_equal expected_option_definitions, actual_option_definitions
49
47
  end
@@ -68,14 +66,14 @@ module Cri
68
66
 
69
67
  # Run
70
68
  $did_it_work = :sadly_not
71
- command.run(%w( -s --long ))
69
+ command.run(%w(-s --long))
72
70
  assert_equal :probably, $did_it_work
73
71
 
74
72
  # Check options
75
73
  expected_option_definitions = Set.new([
76
- { :short => 's', :long => nil, :desc => 'short', :argument => :forbidden, :multiple => false, :hidden => false, :block => nil },
77
- { :short => nil, :long => 'long', :desc => 'long', :argument => :forbidden, :multiple => false, :hidden => false, :block => nil },
78
- ])
74
+ { short: 's', long: nil, desc: 'short', argument: :forbidden, multiple: false, hidden: false, block: nil },
75
+ { short: nil, long: 'long', desc: 'long', argument: :forbidden, multiple: false, hidden: false, block: nil },
76
+ ])
79
77
  actual_option_definitions = Set.new(command.option_definitions)
80
78
  assert_equal expected_option_definitions, actual_option_definitions
81
79
  end
@@ -84,9 +82,9 @@ module Cri
84
82
  # Define
85
83
  dsl = Cri::CommandDSL.new
86
84
  dsl.instance_eval do
87
- flag :f, :flag, 'flag', :multiple => true
88
- required :r, :required, 'req', :multiple => true
89
- optional :o, :optional, 'opt', :multiple => true
85
+ flag :f, :flag, 'flag', multiple: true
86
+ required :r, :required, 'req', multiple: true
87
+ optional :o, :optional, 'opt', multiple: true
90
88
 
91
89
  run { |_opts, _args| }
92
90
  end
@@ -94,10 +92,10 @@ module Cri
94
92
 
95
93
  # Check options
96
94
  expected_option_definitions = Set.new([
97
- { :short => 'f', :long => 'flag', :desc => 'flag', :argument => :forbidden, :multiple => true, :hidden => false, :block => nil },
98
- { :short => 'r', :long => 'required', :desc => 'req', :argument => :required, :multiple => true, :hidden => false, :block => nil },
99
- { :short => 'o', :long => 'optional', :desc => 'opt', :argument => :optional, :multiple => true, :hidden => false, :block => nil },
100
- ])
95
+ { short: 'f', long: 'flag', desc: 'flag', argument: :forbidden, multiple: true, hidden: false, block: nil },
96
+ { short: 'r', long: 'required', desc: 'req', argument: :required, multiple: true, hidden: false, block: nil },
97
+ { short: 'o', long: 'optional', desc: 'opt', argument: :optional, multiple: true, hidden: false, block: nil },
98
+ ])
101
99
  actual_option_definitions = Set.new(command.option_definitions)
102
100
  assert_equal expected_option_definitions, actual_option_definitions
103
101
  end
@@ -106,9 +104,9 @@ module Cri
106
104
  # Define
107
105
  dsl = Cri::CommandDSL.new
108
106
  dsl.instance_eval do
109
- flag :f, :flag, 'flag', :hidden => true
110
- required :r, :required, 'req', :hidden => true
111
- optional :o, :optional, 'opt', :hidden => true
107
+ flag :f, :flag, 'flag', hidden: true
108
+ required :r, :required, 'req', hidden: true
109
+ optional :o, :optional, 'opt', hidden: true
112
110
 
113
111
  run { |_opts, _args| }
114
112
  end
@@ -116,10 +114,10 @@ module Cri
116
114
 
117
115
  # Check options
118
116
  expected_option_definitions = Set.new([
119
- { :short => 'f', :long => 'flag', :desc => 'flag', :argument => :forbidden, :multiple => false, :hidden => true, :block => nil },
120
- { :short => 'r', :long => 'required', :desc => 'req', :argument => :required, :multiple => false, :hidden => true, :block => nil },
121
- { :short => 'o', :long => 'optional', :desc => 'opt', :argument => :optional, :multiple => false, :hidden => true, :block => nil },
122
- ])
117
+ { short: 'f', long: 'flag', desc: 'flag', argument: :forbidden, multiple: false, hidden: true, block: nil },
118
+ { short: 'r', long: 'required', desc: 'req', argument: :required, multiple: false, hidden: true, block: nil },
119
+ { short: 'o', long: 'optional', desc: 'opt', argument: :optional, multiple: false, hidden: true, block: nil },
120
+ ])
123
121
  actual_option_definitions = Set.new(command.option_definitions)
124
122
  assert_equal expected_option_definitions, actual_option_definitions
125
123
  end
@@ -175,7 +173,7 @@ module Cri
175
173
  command = dsl.command
176
174
 
177
175
  # Check
178
- assert_equal %w( aah moo ), command.aliases.sort
176
+ assert_equal %w(aah moo), command.aliases.sort
179
177
  end
180
178
 
181
179
  def test_run_arity
@@ -204,7 +202,7 @@ module Cri
204
202
 
205
203
  # Check
206
204
  $did_it_work = false
207
- command.run(%w( certainly ))
205
+ command.run(%w(certainly))
208
206
  assert_equal 'certainly', $did_it_work
209
207
  end
210
208
  end