ehbrs-tools 0.16.2 → 0.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ehbrs/cooking_book.rb +9 -0
  3. data/lib/ehbrs/cooking_book/build.rb +45 -0
  4. data/lib/ehbrs/cooking_book/build/base_page.rb +43 -0
  5. data/lib/ehbrs/cooking_book/build/index_page.rb +26 -0
  6. data/lib/ehbrs/cooking_book/build/recipe_page.rb +27 -0
  7. data/lib/ehbrs/cooking_book/project.rb +25 -0
  8. data/lib/ehbrs/cooking_book/recipe.rb +37 -0
  9. data/lib/ehbrs/cooking_book/recipe/ingredient.rb +21 -0
  10. data/lib/ehbrs/cooking_book/recipe/measure.rb +60 -0
  11. data/lib/ehbrs/cooking_book/recipe/part.rb +32 -0
  12. data/lib/ehbrs/patches/module/erb_template.rb +11 -0
  13. data/lib/ehbrs/patches/object/erb_template.rb +9 -0
  14. data/lib/ehbrs/patches/object/template.rb +7 -0
  15. data/lib/ehbrs/runner.rb +6 -13
  16. data/lib/ehbrs/runner/cooking_book.rb +30 -0
  17. data/lib/ehbrs/runner/cooking_book/build.rb +32 -0
  18. data/lib/ehbrs/runner/telegram.rb +26 -0
  19. data/lib/ehbrs/runner/telegram/send_message.rb +29 -0
  20. data/lib/ehbrs/telegram.rb +9 -0
  21. data/lib/ehbrs/telegram/message_sending.rb +32 -0
  22. data/lib/ehbrs/tools/application.rb +13 -0
  23. data/lib/ehbrs/tools/instance.rb +16 -0
  24. data/lib/ehbrs/tools/version.rb +1 -1
  25. data/lib/ehbrs/videos/track.rb +1 -19
  26. data/lib/ehbrs/videos/unsupported/checks/codec_extra_unlisted.rb +1 -1
  27. data/lib/ehbrs/videos/unsupported/checks/codec_extra_unsupported.rb +1 -1
  28. data/lib/ehbrs/videos/unsupported/checks/codec_unlisted.rb +2 -2
  29. data/lib/ehbrs/videos/unsupported/checks/codec_unsupported.rb +1 -1
  30. data/lib/ehbrs/videos/unsupported/fix_profile.rb +0 -13
  31. data/lib/ehbrs/videos/unsupported/fixes/supported_codec.rb +10 -10
  32. data/template/ehbrs/cooking_book/build/base_page/layout.html.erb +20 -0
  33. data/template/ehbrs/cooking_book/build/index_page/inner.html.erb +6 -0
  34. data/template/ehbrs/cooking_book/build/recipe_page/inner.html.erb +6 -0
  35. data/template/ehbrs/cooking_book/build/recipe_page/part.html.erb +27 -0
  36. data/vendor/eac_cli/eac_cli.gemspec +1 -1
  37. data/vendor/eac_cli/lib/eac_cli/docopt/runner_context_replacement.rb +15 -0
  38. data/vendor/eac_cli/lib/eac_cli/docopt/runner_extension.rb +5 -0
  39. data/vendor/eac_cli/lib/eac_cli/parser.rb +6 -4
  40. data/vendor/eac_cli/lib/eac_cli/parser/alternative.rb +8 -4
  41. data/vendor/eac_cli/lib/eac_cli/parser/alternative/long_options.rb +37 -0
  42. data/vendor/eac_cli/lib/eac_cli/parser/alternative/option_argument.rb +29 -0
  43. data/vendor/eac_cli/lib/eac_cli/parser/alternative/options.rb +7 -36
  44. data/vendor/eac_cli/lib/eac_cli/parser/alternative/short_options.rb +45 -0
  45. data/vendor/eac_cli/lib/eac_cli/runner.rb +10 -2
  46. data/vendor/eac_cli/lib/eac_cli/runner/exit.rb +13 -0
  47. data/vendor/eac_cli/lib/eac_cli/runner_with/help.rb +17 -0
  48. data/vendor/eac_cli/lib/eac_cli/runner_with/subcommands.rb +19 -2
  49. data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
  50. data/vendor/eac_cli/spec/lib/eac_cli/runner_spec.rb +28 -4
  51. data/vendor/eac_cli/spec/lib/eac_cli/runner_with/help_spec.rb +42 -0
  52. data/vendor/eac_cli/spec/lib/eac_cli/runner_with/subcommands_spec.rb +29 -1
  53. data/vendor/eac_docker/lib/eac_docker/container.rb +24 -0
  54. data/vendor/eac_docker/lib/eac_docker/images/coded.rb +39 -0
  55. data/vendor/eac_docker/lib/eac_docker/images/templatized.rb +26 -0
  56. data/vendor/eac_docker/lib/eac_docker/registry.rb +17 -0
  57. data/vendor/eac_docker/lib/eac_docker/version.rb +1 -1
  58. data/vendor/eac_docker/spec/lib/eac_docker/images/coded_spec.rb +12 -0
  59. data/vendor/eac_docker/spec/lib/eac_docker/images/coded_spec_files/image1/Dockerfile +1 -0
  60. data/vendor/eac_docker/spec/lib/eac_docker/images/templatized_spec.rb +17 -0
  61. data/vendor/eac_docker/spec/lib/eac_docker/images/templatized_spec_files/stub_docker_image/Dockerfile +1 -0
  62. data/vendor/eac_ruby_base0/Gemfile +5 -0
  63. data/vendor/eac_ruby_base0/eac_ruby_base0.gemspec +20 -0
  64. data/vendor/eac_ruby_base0/lib/eac_ruby_base0.rb +7 -0
  65. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/application.rb +69 -0
  66. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner.rb +54 -0
  67. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner/test_all.rb +22 -0
  68. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/version.rb +5 -0
  69. data/vendor/eac_ruby_base0/spec/rubocop_spec.rb +7 -0
  70. data/vendor/eac_ruby_base0/spec/spec_helper.rb +100 -0
  71. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_concern.rb +2 -50
  72. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_concern/class_setup.rb +52 -0
  73. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_concern/module_setup.rb +41 -0
  74. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_constructor.rb +6 -50
  75. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_constructor/class_initialize.rb +29 -0
  76. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_constructor/instance_initialize.rb +53 -0
  77. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_constructor/super_args.rb +54 -0
  78. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner/_subcommands.rb +10 -1
  79. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command.rb +4 -6
  80. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command/concat.rb +33 -0
  81. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command/envvars.rb +24 -0
  82. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command/extra_options.rb +0 -21
  83. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/fs/traverser.rb +0 -2
  84. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/inflector.rb +4 -1
  85. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/local_time_zone.rb +38 -0
  86. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/kernel.rb +4 -0
  87. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/kernel/nyi.rb +8 -0
  88. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/template.rb +10 -0
  89. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/template.rb +1 -8
  90. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/basename_sub.rb +2 -2
  91. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/time/default_time_zone_set.rb +3 -2
  92. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/struct.rb +7 -1
  93. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  94. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/yaml.rb +8 -0
  95. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/common_concern_spec.rb +40 -17
  96. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/common_constructor_spec.rb +96 -8
  97. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/inflector_spec.rb +2 -1
  98. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/local_time_zone_spec.rb +17 -0
  99. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/struct_spec.rb +12 -1
  100. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/version.rb +1 -1
  101. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/stream.rb +1 -1
  102. metadata +101 -9
  103. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/time/local_time_zone.rb +0 -25
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EacCli
4
+ class Parser
5
+ class Alternative
6
+ module LongOptions
7
+ LONG_OPTION_PREFIX = '--'
8
+ OPTION_WITH_ARGUMENT_PATTERN = /\A([^=]+)(?:=(.*))\z/.freeze
9
+
10
+ private
11
+
12
+ def argv_current_long_option?
13
+ phase == PHASE_ANY && argv_enum.peek.start_with?(LONG_OPTION_PREFIX) &&
14
+ !argv_current_double_dash?
15
+ end
16
+
17
+ def long_option_collect_argv_value
18
+ option_long, value = parse_option_current_argv
19
+ alternative.options.any? do |option|
20
+ next false unless option.long == option_long
21
+
22
+ if value.nil?
23
+ option_collect_option(option)
24
+ else
25
+ option_argument_collect(option, value)
26
+ end
27
+ end || raise_argv_current_invalid_option
28
+ end
29
+
30
+ def parse_option_current_argv
31
+ m = OPTION_WITH_ARGUMENT_PATTERN.match(argv_enum.peek)
32
+ m ? [m[1], m[2].if_present('')] : [argv_enum.peek, nil]
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EacCli
4
+ class Parser
5
+ class Alternative
6
+ module OptionArgument
7
+ private
8
+
9
+ attr_accessor :argument_option
10
+
11
+ def argument_option_collect_argv(option)
12
+ self.argument_option = option
13
+ self.phase = PHASE_OPTION_ARGUMENT
14
+ end
15
+
16
+ def option_argument_collect(option, value)
17
+ collector.collect(option, value)
18
+ self.argument_option = nil
19
+ self.phase = PHASE_ANY
20
+ option
21
+ end
22
+
23
+ def option_argument_collect_argv_value
24
+ option_argument_collect(argument_option, argv_enum.peek)
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -4,49 +4,20 @@ module EacCli
4
4
  class Parser
5
5
  class Alternative
6
6
  module Options
7
- DOUBLE_DASH = '--'
8
-
9
7
  private
10
8
 
11
- attr_accessor :argument_option, :double_dash
12
-
13
- def argument_option_collect_argv(option)
14
- self.argument_option = option
15
- self.phase = PHASE_OPTION_ARGUMENT
16
- end
17
-
18
- def argv_current_option?
19
- phase == PHASE_ANY && argv_enum.peek.start_with?('-')
20
- end
21
-
22
- def argv_current_double_dash?
23
- argv_enum.peek == DOUBLE_DASH && !double_dash
24
- end
25
-
26
9
  def boolean_option_collect_argv(option)
27
10
  collector.collect(option, true)
28
11
  end
29
12
 
30
- def option_argument_collect_argv_value
31
- collector.collect(argument_option, argv_enum.peek)
32
- self.argument_option = nil
33
- self.phase = PHASE_ANY
34
- end
35
-
36
- def option_collect_argv_value
37
- return double_dash_collect_argv_value if argv_current_double_dash?
38
-
39
- alternative.options.any? do |option|
40
- next false unless [option.short, option.long].include?(argv_enum.peek)
41
-
42
- if option.argument?
43
- argument_option_collect_argv(option)
44
- else
45
- boolean_option_collect_argv(option)
46
- end
13
+ def option_collect_option(option)
14
+ if option.argument?
15
+ argument_option_collect_argv(option)
16
+ else
17
+ boolean_option_collect_argv(option)
18
+ end
47
19
 
48
- true
49
- end || raise_argv_current_invalid_option
20
+ option
50
21
  end
51
22
 
52
23
  def raise_argv_current_invalid_option
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EacCli
4
+ class Parser
5
+ class Alternative
6
+ module ShortOptions
7
+ SHORT_OPTION_PREFIX = '-'
8
+
9
+ private
10
+
11
+ def argv_current_short_option?
12
+ phase == PHASE_ANY && argv_enum.peek.start_with?(SHORT_OPTION_PREFIX) &&
13
+ !argv_current_long_option?
14
+ end
15
+
16
+ def find_short_option(char)
17
+ alternative.options.find { |option| short_without_prefix(option.short) == char }
18
+ end
19
+
20
+ def short_option_collect_argv_value
21
+ last_option = nil
22
+ short_without_prefix(argv_enum.peek).each_char do |char|
23
+ raise_error "Option \"#{last_option}\" requires a argument not provided" if
24
+ last_option.present?
25
+
26
+ collected_option = short_option_collect_char(char)
27
+ last_option = collected_option if collected_option.argument?
28
+ end
29
+ end
30
+
31
+ # @return [EacCli::Definition::BaseOption] The option collected.
32
+ def short_option_collect_char(char)
33
+ option = find_short_option(char)
34
+ raise_error "Invalid short option \"#{char}\"" unless option
35
+
36
+ option_collect_option(option)
37
+ end
38
+
39
+ def short_without_prefix(short)
40
+ short.gsub(/\A#{::Regexp.quote(SHORT_OPTION_PREFIX)}/, '')
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -44,6 +44,8 @@ module EacCli
44
44
  extend AfterClassMethods
45
45
  include InstanceMethods
46
46
  ::EacCli::Docopt::RunnerExtension.check(self)
47
+ include ActiveSupport::Callbacks
48
+ define_callbacks :run
47
49
  end
48
50
 
49
51
  module AfterClassMethods
@@ -55,8 +57,7 @@ module EacCli
55
57
 
56
58
  def run(*runner_context_args)
57
59
  r = create(*runner_context_args)
58
- r.parsed
59
- r.run
60
+ r.run_run
60
61
  r
61
62
  end
62
63
 
@@ -72,6 +73,13 @@ module EacCli
72
73
  end
73
74
 
74
75
  module InstanceMethods
76
+ def run_run
77
+ parsed
78
+ run_callbacks(:run) { run }
79
+ rescue ::EacCli::Runner::Exit # rubocop:disable Lint/SuppressedException
80
+ # Do nothing
81
+ end
82
+
75
83
  def runner_context
76
84
  return @runner_context if @runner_context
77
85
 
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EacCli
4
+ module Runner
5
+ class Exit < ::StandardError
6
+ attr_reader :status
7
+
8
+ def initialize(status = true)
9
+ @status = status
10
+ end
11
+ end
12
+ end
13
+ end
@@ -13,6 +13,23 @@ module EacCli
13
13
  options_argument false
14
14
  bool_opt '-h', '--help', 'Show help.', usage: true
15
15
  end
16
+
17
+ set_callback :run, :before do
18
+ help_run
19
+ end
20
+ end
21
+
22
+ def help_run
23
+ return unless parsed.help?
24
+
25
+ puts help_text
26
+ raise ::EacCli::Runner::Exit
27
+ end
28
+
29
+ def help_text
30
+ r = ::EacCli::Docopt::DocBuilder.new(self.class.runner_definition).to_s
31
+ r += help_extra_text if respond_to?(:help_extra_text)
32
+ r
16
33
  end
17
34
  end
18
35
  end
@@ -6,6 +6,14 @@ require 'eac_ruby_utils/core_ext'
6
6
  module EacCli
7
7
  module RunnerWith
8
8
  module Subcommands
9
+ class << self
10
+ def runner?(object)
11
+ ::EacCli::Runner.runner?(object) || (
12
+ object.is_a?(::Class) && object < ::EacRubyUtils::Console::DocoptRunner
13
+ )
14
+ end
15
+ end
16
+
9
17
  common_concern do
10
18
  include ::EacCli::Runner
11
19
  end
@@ -19,7 +27,7 @@ module EacCli
19
27
  def available_subcommands_auto
20
28
  self.class.constants
21
29
  .map { |name| [name.to_s.underscore.gsub('_', '-'), self.class.const_get(name)] }
22
- .select { |c| ::EacCli::Runner.runner?(c[1]) }
30
+ .select { |c| ::EacCli::RunnerWith::Subcommands.runner?(c[1]) }
23
31
  .to_h.with_indifferent_access
24
32
  end
25
33
 
@@ -31,6 +39,11 @@ module EacCli
31
39
  end
32
40
  end
33
41
 
42
+ def help_extra_text
43
+ (['Subcommands:'] + available_subcommands.keys.map { |s| " #{s}" })
44
+ .map { |v| "#{v}\n" }.join
45
+ end
46
+
34
47
  def method_missing(method_name, *arguments, &block)
35
48
  return run_with_subcommand(*arguments, &block) if
36
49
  run_with_subcommand_alias_run?(method_name)
@@ -44,7 +57,11 @@ module EacCli
44
57
 
45
58
  def run_with_subcommand
46
59
  if subcommand_name
47
- subcommand_runner.run
60
+ if subcommand_runner.respond_to?(:run_run)
61
+ subcommand_runner.run_run
62
+ else
63
+ subcommand_runner.run
64
+ end
48
65
  else
49
66
  run_without_subcommand
50
67
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacCli
4
- VERSION = '0.12.2'
4
+ VERSION = '0.12.5'
5
5
  end
@@ -11,7 +11,7 @@ RSpec.describe ::EacCli::Runner do
11
11
 
12
12
  runner_definition do
13
13
  arg_opt '-o', '--opt1', 'A arg option.'
14
- bool_opt '-o', '--opt2', 'A boolean option'
14
+ bool_opt '-p', '--opt2', 'A boolean option'
15
15
  pos_arg :pos1
16
16
  pos_arg :pos2, repeat: true, optional: true
17
17
  alt do
@@ -28,7 +28,10 @@ RSpec.describe ::EacCli::Runner do
28
28
 
29
29
  context 'when all args are supplied' do
30
30
  let(:argv) { %w[--opt1 aaa --opt2 bbb ccc ddd] }
31
- let(:parsed_expected) { { opt1: 'aaa', opt2: true, pos1: 'bbb', pos2: %w[ccc ddd] } }
31
+ let(:parsed_expected) do
32
+ { opt1: 'aaa', opt2: true, opt3: false, pos1: 'bbb',
33
+ pos2: %w[ccc ddd] }
34
+ end
32
35
 
33
36
  it { expect(parsed_actual).to eq(parsed_expected) }
34
37
  it { expect(instance.parsed.opt1).to eq('aaa') }
@@ -37,9 +40,30 @@ RSpec.describe ::EacCli::Runner do
37
40
  it { expect(instance.parsed.pos2).to eq(%w[ccc ddd]) }
38
41
  end
39
42
 
43
+ context 'with long option and argument in same position' do
44
+ let(:argv) { %w[--opt1=aaa pos1] }
45
+
46
+ it { expect(instance.parsed.opt1).to eq('aaa') }
47
+ end
48
+
49
+ context 'with valid grouped short options' do
50
+ let(:argv) { %w[-po aaa pos1] }
51
+
52
+ it { expect(instance.parsed.opt1).to eq('aaa') }
53
+ it { expect(instance.parsed.opt2?).to eq(true) }
54
+ end
55
+
56
+ context 'with invalid grouped short options' do
57
+ let(:argv) { %w[-op aaa pos1] }
58
+
59
+ it do
60
+ expect { instance.parsed }.to raise_error(::EacCli::Parser::Error)
61
+ end
62
+ end
63
+
40
64
  context 'when only required args are supplied' do
41
65
  let(:argv) { %w[bbb] }
42
- let(:parsed_expected) { { opt1: nil, opt2: false, pos1: 'bbb', pos2: [] } }
66
+ let(:parsed_expected) { { opt1: nil, opt2: false, opt3: false, pos1: 'bbb', pos2: [] } }
43
67
 
44
68
  it { expect(parsed_actual).to eq(parsed_expected) }
45
69
  it { expect(instance.parsed.opt1).to be_nil }
@@ -58,7 +82,7 @@ RSpec.describe ::EacCli::Runner do
58
82
 
59
83
  context 'when alternative args are supplied' do
60
84
  let(:argv) { %w[--opt3] }
61
- let(:parsed_expected) { { opt3: true } }
85
+ let(:parsed_expected) { { opt1: nil, opt2: false, opt3: true, pos1: nil, pos2: [] } }
62
86
 
63
87
  it { expect(parsed_actual).to eq(parsed_expected) }
64
88
  it { expect(instance.parsed.opt3?).to eq(true) }
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_cli/runner_with/help'
4
+ require 'eac_ruby_utils/fs/temp'
5
+
6
+ RSpec.describe ::EacCli::RunnerWith::Help do
7
+ let(:runner) do
8
+ the_module = described_class
9
+ Class.new do
10
+ include the_module
11
+
12
+ runner_definition do
13
+ desc 'A stub runner.'
14
+ pos_arg :a_argument
15
+ end
16
+
17
+ def run
18
+ puts 'Runner run'
19
+ end
20
+ end
21
+ end
22
+
23
+ let(:runner_argv) { ['--help'] }
24
+ let(:instance) { runner.create(argv: runner_argv) }
25
+ let(:expected_output) do
26
+ <<~OUTPUT
27
+ A stub runner.
28
+
29
+ Usage:
30
+ __PROGRAM__ [options] <a_argument>
31
+ __PROGRAM__ --help
32
+
33
+ Options:
34
+ -h --help Show help.
35
+
36
+ OUTPUT
37
+ end
38
+
39
+ it 'show help text' do
40
+ expect { instance.run_run }.to output(expected_output).to_stdout_from_any_process
41
+ end
42
+ end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_cli/runner'
4
+ require 'eac_cli/runner_with/help'
4
5
  require 'eac_cli/runner_with/subcommands'
5
6
 
6
7
  RSpec.describe ::EacCli::RunnerWith::Subcommands do
@@ -8,7 +9,6 @@ RSpec.describe ::EacCli::RunnerWith::Subcommands do
8
9
  the_module = described_class
9
10
  the_child = child_runner
10
11
  Class.new do
11
- include ::EacCli::Runner
12
12
  include the_module
13
13
  const_set('ChildCmd', the_child)
14
14
 
@@ -54,4 +54,32 @@ RSpec.describe ::EacCli::RunnerWith::Subcommands do
54
54
  expect { instance.run }.to raise_error(::EacCli::Parser::Error)
55
55
  end
56
56
  end
57
+
58
+ context 'with help' do
59
+ let(:instance) { parent_runner.create(%w[--help]) }
60
+ let(:expected_output) do
61
+ <<~OUTPUT
62
+ A stub root runner.
63
+
64
+ Usage:
65
+ __PROGRAM__ [options] __SUBCOMMANDS__ [<subcommand_args>...]
66
+ __PROGRAM__ --help
67
+
68
+ Options:
69
+ -r --root-var=<value> A root variable.
70
+ -h --help Show help.
71
+
72
+ Subcommands:
73
+ child-cmd
74
+ OUTPUT
75
+ end
76
+
77
+ before do
78
+ parent_runner.include(::EacCli::RunnerWith::Help)
79
+ end
80
+
81
+ it 'show help text' do
82
+ expect { instance.run_run }.to output(expected_output).to_stdout_from_any_process
83
+ end
84
+ end
57
85
  end