eac_cli 0.31.0 → 0.32.0
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d1e50e2a284a092f29a86d4ed6871c5f72d60cd0b655f8ab991d281bc0245786
|
4
|
+
data.tar.gz: 88e1aac4d700544a32debe645752a192f2732ee2e4f248796a952acf33853dab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1cfe95828490465373b2cacb1f7a8a087903466b89ec0a7fb208cbe05742c5a8c498834350aa35d606cefe900e088853c9b6f5fd5213c71e4a25bb1843616564
|
7
|
+
data.tar.gz: 9d38a66bd9b3b1f3dea27c386a50a26c430cc94ed142ab5733297ab499ad4bf718b04f17d81b765e54e6d9c08e3517abc519877b54bf521e2c15e6704c80db75
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'eac_cli/runner_with/help/list_section'
|
3
4
|
require 'eac_ruby_utils/core_ext'
|
4
5
|
|
5
6
|
module EacCli
|
@@ -9,9 +10,8 @@ module EacCli
|
|
9
10
|
require_sub __FILE__, require_dependency: true
|
10
11
|
common_constructor :runner
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
OPTION_DESC_SEP = IDENT * 2
|
13
|
+
OPTION_DESC_SEP = ::EacCli::RunnerWith::Help::ListSection::IDENTATION * 2
|
14
|
+
SECTION_SEPARATOR = "\n"
|
15
15
|
|
16
16
|
class << self
|
17
17
|
def option_long(option)
|
@@ -35,7 +35,7 @@ module EacCli
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def word_separator
|
38
|
-
|
38
|
+
::EacCli::RunnerWith::Help::ListSection::WORD_SEPARATOR
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
@@ -45,36 +45,53 @@ module EacCli
|
|
45
45
|
runner.class.runner_definition
|
46
46
|
end
|
47
47
|
|
48
|
+
# @return [String, nil]
|
49
|
+
def extra_section
|
50
|
+
ess = extra_sections
|
51
|
+
return nil if ess.none?
|
52
|
+
|
53
|
+
ess.join(SECTION_SEPARATOR)
|
54
|
+
end
|
55
|
+
|
56
|
+
# @return [Enumerable<String>]
|
57
|
+
def extra_sections
|
58
|
+
runner.if_respond(:help_extra_text, []) do |v|
|
59
|
+
if v.is_a?(::Hash)
|
60
|
+
v.map do |title, lines|
|
61
|
+
::EacCli::RunnerWith::Help::ListSection.new(title, lines)
|
62
|
+
end
|
63
|
+
else
|
64
|
+
[v.to_s]
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
48
69
|
def option_definition(option)
|
49
70
|
[self.class.option_usage_full(option), option.description,
|
50
71
|
option.default_value? ? "[Default: \"#{option.default_value}\"]" : nil]
|
51
72
|
.reject(&:blank?).join(OPTION_DESC_SEP)
|
52
73
|
end
|
53
74
|
|
54
|
-
|
55
|
-
b = include_header ? "#{header.humanize}:\n" : ''
|
56
|
-
b += send("self_#{header}") + "\n"
|
57
|
-
definition.alternatives.each do |alternative|
|
58
|
-
b += IDENT + self.alternative(alternative) + "\n"
|
59
|
-
end
|
60
|
-
b
|
61
|
-
end
|
62
|
-
|
75
|
+
# @return [String]
|
63
76
|
def options_section
|
64
|
-
|
65
|
-
|
66
|
-
|
77
|
+
::EacCli::RunnerWith::Help::ListSection.new(
|
78
|
+
'Options',
|
79
|
+
definition.alternatives.flat_map(&:options).map { |option| option_definition(option) }
|
80
|
+
)
|
67
81
|
end
|
68
82
|
|
83
|
+
# @return [String]
|
69
84
|
def usage_section
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
85
|
+
::EacCli::RunnerWith::Help::ListSection.new(
|
86
|
+
'Usage',
|
87
|
+
definition.alternatives.map { |alternative| self.alternative(alternative) }
|
88
|
+
)
|
74
89
|
end
|
75
90
|
|
76
91
|
def to_s
|
77
|
-
"#{definition.description}\n
|
92
|
+
r = ["#{definition.description}\n", usage_section, options_section]
|
93
|
+
.map { |s| "#{s}#{SECTION_SEPARATOR}" }.join
|
94
|
+
extra_section.if_present(r) { |v| r + v }
|
78
95
|
end
|
79
96
|
end
|
80
97
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module EacCli
|
6
|
+
module RunnerWith
|
7
|
+
module Help
|
8
|
+
class ListSection
|
9
|
+
WORD_SEPARATOR = ' '
|
10
|
+
IDENTATION = WORD_SEPARATOR * 2
|
11
|
+
|
12
|
+
common_constructor :title, :items
|
13
|
+
|
14
|
+
# @return [String]
|
15
|
+
def to_s
|
16
|
+
(["#{title}:"] + items.map { |line| "#{IDENTATION}#{line}" })
|
17
|
+
.map { |line| "#{line}\n" }.join
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -6,7 +6,7 @@ require 'eac_ruby_utils/core_ext'
|
|
6
6
|
module EacCli
|
7
7
|
module RunnerWith
|
8
8
|
module Help
|
9
|
-
require_sub __FILE__,
|
9
|
+
require_sub __FILE__, require_mode: :kernel
|
10
10
|
common_concern do
|
11
11
|
include ::EacCli::Runner
|
12
12
|
|
@@ -27,10 +27,9 @@ module EacCli
|
|
27
27
|
raise ::EacCli::Runner::Exit
|
28
28
|
end
|
29
29
|
|
30
|
+
# @return [String]
|
30
31
|
def help_text
|
31
|
-
|
32
|
-
r += help_extra_text if respond_to?(:help_extra_text)
|
33
|
-
r
|
32
|
+
::EacCli::RunnerWith::Help::Builder.new(self).to_s
|
34
33
|
end
|
35
34
|
|
36
35
|
def show_help?
|
@@ -51,9 +51,12 @@ module EacCli
|
|
51
51
|
available_subcommands.keys.sort.join(', ')
|
52
52
|
end
|
53
53
|
|
54
|
+
# @return [Hash<String, Enumerable<String>]
|
54
55
|
def help_extra_text
|
55
|
-
|
56
|
-
|
56
|
+
{
|
57
|
+
'Subcommands' =>
|
58
|
+
available_subcommands.keys.sort
|
59
|
+
}
|
57
60
|
end
|
58
61
|
|
59
62
|
def method_missing(method_name, *arguments, &block)
|
data/lib/eac_cli/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eac_cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.32.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Esquilo Azul Company
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-05-
|
11
|
+
date: 2023-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -50,14 +50,14 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '0.
|
53
|
+
version: '0.113'
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '0.
|
60
|
+
version: '0.113'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: eac_ruby_gem_support
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -126,6 +126,7 @@ files:
|
|
126
126
|
- lib/eac_cli/runner_with/help.rb
|
127
127
|
- lib/eac_cli/runner_with/help/builder.rb
|
128
128
|
- lib/eac_cli/runner_with/help/builder/alternative.rb
|
129
|
+
- lib/eac_cli/runner_with/help/list_section.rb
|
129
130
|
- lib/eac_cli/runner_with/input.rb
|
130
131
|
- lib/eac_cli/runner_with/output.rb
|
131
132
|
- lib/eac_cli/runner_with/subcommands.rb
|