eac_cli 0.43.1 → 0.44.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: bc415ea65a5c2cf068d1670242f07ecefbe9b4563266cb42c681b243bf2c403c
|
4
|
+
data.tar.gz: 2dc354cc1e65fb564ca7ce418b0e2dee3b2c2cd663494e42dff8f95fbabb333b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c43e284522d6649ec80940f22811c257a247713e00423a63c946ac3464fff18217b3f48c01653676b8f8435e3bbbca5e57fed9313337b8f016769e0b56f9c56e
|
7
|
+
data.tar.gz: c22096bac61407cd69db288bd5b451b8fc01fbba0c121fcf0a86bf5a5e1808a8385da7c18104522b7c98d20f52af833b34a11047ef3e4638a6edc7101d3b8968
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'yaml'
|
4
|
+
|
5
|
+
module EacCli
|
6
|
+
module RunnerWith
|
7
|
+
module OutputItem
|
8
|
+
class AsciidocFormatter < ::EacCli::RunnerWith::OutputItem::BaseFormatter
|
9
|
+
STARTING_LEVEL = 2
|
10
|
+
|
11
|
+
# @return [String]
|
12
|
+
def to_output
|
13
|
+
output_hash(item_hash, STARTING_LEVEL)
|
14
|
+
end
|
15
|
+
|
16
|
+
protected
|
17
|
+
|
18
|
+
# @param hash [Hash]
|
19
|
+
# @param level [Integer]
|
20
|
+
# @return [String]
|
21
|
+
def output_enumerable(enumerable, level)
|
22
|
+
enumerable.map { |e| output_object(e, level + 1) }.join
|
23
|
+
end
|
24
|
+
|
25
|
+
# @param hash [Hash]
|
26
|
+
# @param level [Integer]
|
27
|
+
# @return [String]
|
28
|
+
def output_hash(hash, level)
|
29
|
+
hash.map { |k, v| section(k, v, level) }.join("\n")
|
30
|
+
end
|
31
|
+
|
32
|
+
def output_object(object, level)
|
33
|
+
return output_hash(object, level) if object.is_a?(::Hash)
|
34
|
+
return output_enumerable(object, level) if object.is_a?(::Enumerable)
|
35
|
+
|
36
|
+
output_string(object, level)
|
37
|
+
end
|
38
|
+
|
39
|
+
# @param string [String]
|
40
|
+
# @param level [Integer]
|
41
|
+
# @return [String]
|
42
|
+
def output_string(string, _level)
|
43
|
+
"* #{string.to_s.strip}\n"
|
44
|
+
end
|
45
|
+
|
46
|
+
# @param title [String]
|
47
|
+
# @param content [String]
|
48
|
+
# @param level [Integer]
|
49
|
+
# @return [String]
|
50
|
+
def section(title, content, level)
|
51
|
+
"#{section_title(title, level)}\n\n#{section_content(content, level)}"
|
52
|
+
end
|
53
|
+
|
54
|
+
# @param title [String]
|
55
|
+
# @param level [Integer]
|
56
|
+
# @return [String]
|
57
|
+
def section_title(title, level)
|
58
|
+
"#{'=' * level} #{title}"
|
59
|
+
end
|
60
|
+
|
61
|
+
# @param content [String]
|
62
|
+
# @param level [Integer]
|
63
|
+
# @return [String]
|
64
|
+
def section_content(content, level)
|
65
|
+
output_object(content, level)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -5,10 +5,7 @@ module EacCli
|
|
5
5
|
module OutputItem
|
6
6
|
require_sub __FILE__
|
7
7
|
|
8
|
-
FORMATS =
|
9
|
-
'csv' => ::EacCli::RunnerWith::OutputItem::CsvFormatter,
|
10
|
-
'yaml' => ::EacCli::RunnerWith::OutputItem::YamlFormatter
|
11
|
-
}.freeze
|
8
|
+
FORMATS = %w[asciidoc csv yaml].freeze
|
12
9
|
|
13
10
|
common_concern do
|
14
11
|
acts_as_abstract :item_hash
|
@@ -31,7 +28,19 @@ module EacCli
|
|
31
28
|
|
32
29
|
# @return [Class]
|
33
30
|
def formatter_class
|
34
|
-
|
31
|
+
formats.fetch(parsed.format)
|
32
|
+
end
|
33
|
+
|
34
|
+
# @return [Hash<String, Class>]
|
35
|
+
def formats
|
36
|
+
FORMATS.to_h do |e|
|
37
|
+
[e, ::EacCli::RunnerWith::OutputItem.const_get("#{e.camelize}Formatter")]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# @return [Hash<String, Enumerable<String>]
|
42
|
+
def help_extra_text
|
43
|
+
help_list_section('Formats', formats.keys.sort)
|
35
44
|
end
|
36
45
|
end
|
37
46
|
end
|
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.44.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: 2025-07-
|
11
|
+
date: 2025-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -161,6 +161,7 @@ files:
|
|
161
161
|
- lib/eac_cli/runner_with/input.rb
|
162
162
|
- lib/eac_cli/runner_with/output.rb
|
163
163
|
- lib/eac_cli/runner_with/output_item.rb
|
164
|
+
- lib/eac_cli/runner_with/output_item/asciidoc_formatter.rb
|
164
165
|
- lib/eac_cli/runner_with/output_item/base_formatter.rb
|
165
166
|
- lib/eac_cli/runner_with/output_item/csv_formatter.rb
|
166
167
|
- lib/eac_cli/runner_with/output_item/yaml_formatter.rb
|