eac_cli 0.43.1 → 0.44.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a50f80215e58b14fecbee9f396a45dfbe786b6cda565b2a7d83cc757b95078bd
4
- data.tar.gz: 6f505b628289249e983583e3b05b416194c2c50135117ad34b0fe2171115164c
3
+ metadata.gz: d84ae043205413a30fd4073e11a7e5633ed3f89c104df9ea0f19751b316aa243
4
+ data.tar.gz: 22445a0cdaf745974e54877a56b67408c7908f7fbb3eec217ecafe644259f2e0
5
5
  SHA512:
6
- metadata.gz: 82ca9e1c4864f7485888846d438c35549b272df5a7e891c441c42a7d8f94527f44e71a167e89494f8d4bfec7a7bd6f4d20e9589c7e3f848ab652d869aa69054b
7
- data.tar.gz: 6c7e8b450efe39faa3c4bb2c263a04c3b508e17b7bcf9a3eb2dc1e4114244ab6f11b99cfc626c20dc6f372fcdbe5ad5be095b00e20d33122ddc89a3fe900e538
6
+ metadata.gz: d192d81a5cedfc729e635c1a4abe5355cbe775e42e5187f94040e61d15ae7886998748f776c4d46894bfdbafdbc821e3bce4289fd479b1e035f210b3f403bf5b
7
+ data.tar.gz: 0b156f6154cf93401de43f00f363d8e0f59e0b2df2e089b87be66ea414810749fe638c1dbc112d9a34acaf28165748bfd3f6001cf614a7e12e03833f1a68c3de
@@ -4,6 +4,7 @@ module EacCli
4
4
  module DefaultRunner
5
5
  common_concern do
6
6
  include ::EacCli::RunnerWith::Help
7
+
7
8
  enable_speaker
8
9
  enable_simple_cache
9
10
  end
@@ -3,6 +3,7 @@
3
3
  class Object
4
4
  def runner_with(*runners, &block)
5
5
  include ::EacCli::Runner
6
+
6
7
  enable_simple_cache
7
8
  enable_speaker
8
9
  runners.each do |runner|
@@ -40,6 +40,7 @@ module EacCli
40
40
  include InstanceMethods
41
41
  include ::EacCli::Runner::ForContext
42
42
  include ActiveSupport::Callbacks
43
+
43
44
  define_callbacks :run
44
45
  end
45
46
  end
@@ -7,6 +7,7 @@ module EacCli
7
7
 
8
8
  common_concern do
9
9
  include ::EacCli::Runner
10
+
10
11
  enable_settings_provider
11
12
  enable_simple_cache
12
13
  runner_definition do
@@ -5,6 +5,7 @@ module EacCli
5
5
  module Help
6
6
  class Builder
7
7
  include ::EacCli::RunnerWith::Help::Layout
8
+
8
9
  require_sub __FILE__, require_mode: :kernel
9
10
  common_constructor :runner
10
11
 
@@ -6,6 +6,7 @@ module EacCli
6
6
  require_sub __FILE__, require_mode: :kernel
7
7
  common_concern do
8
8
  include ::EacCli::Runner
9
+ include ::EacCli::RunnerWith::Help::Layout
9
10
 
10
11
  runner_definition.alt do
11
12
  bool_opt '-h', '--help', 'Show help.', usage: true, required: true
@@ -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
- FORMATS.fetch(parsed.format)
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacCli
4
- VERSION = '0.43.1'
4
+ VERSION = '0.44.1'
5
5
  end
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.43.1
4
+ version: 0.44.1
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-03 00:00:00.000000000 Z
11
+ date: 2025-09-03 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