eac_cli 0.35.1 → 0.37.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 +4 -4
- data/lib/eac_cli/runner_with/output_item/base_formatter.rb +15 -0
- data/lib/eac_cli/runner_with/output_item/csv_formatter.rb +23 -0
- data/lib/eac_cli/runner_with/output_item/yaml_formatter.rb +18 -0
- data/lib/eac_cli/runner_with/output_item.rb +42 -0
- data/lib/eac_cli/runner_with/output_list/base_formatter.rb +30 -0
- data/lib/eac_cli/runner_with/output_list/csv_formatter.rb +26 -0
- data/lib/eac_cli/runner_with/output_list/yaml_formatter.rb +23 -0
- data/lib/eac_cli/runner_with/output_list.rb +42 -0
- data/lib/eac_cli/version.rb +1 -1
- metadata +20 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86b393d29e9db3edc24f1bd34bb4f7ade5935892d8c753b400f7737504d8af21
|
4
|
+
data.tar.gz: 5f609ff444293079bf8f1d21f292aa72d42012814fbbb6c50acc26b56a8d4613
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2fe55eff4ac6b552cd3d6505eae01415e17dd970977f849b320dd8ceddead841537fdaf27675a7751265dd6f6a1e4810e4fd5450ddefd3d6a8a14d989ea9944
|
7
|
+
data.tar.gz: a2ae31d75a0a7c1aa75597072acce427ee1c3c9a345795ff85111c72f493767f3362826d4bd941ce0e0f3ff947a3e0e64b8198f61db934904452f06f11b0dbd0
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
require 'eac_ruby_utils/acts_as_abstract'
|
5
|
+
|
6
|
+
module EacCli
|
7
|
+
module RunnerWith
|
8
|
+
module OutputItem
|
9
|
+
class BaseFormatter
|
10
|
+
acts_as_abstract :to_output
|
11
|
+
common_constructor :item_hash
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'csv'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
require 'eac_cli/runner_with/output_item/base_formatter'
|
6
|
+
|
7
|
+
module EacCli
|
8
|
+
module RunnerWith
|
9
|
+
module OutputItem
|
10
|
+
class CsvFormatter < ::EacCli::RunnerWith::OutputItem::BaseFormatter
|
11
|
+
COLUMNS = %w[key value].freeze
|
12
|
+
|
13
|
+
# @return [String]
|
14
|
+
def to_output
|
15
|
+
::CSV.generate do |csv|
|
16
|
+
csv << COLUMNS
|
17
|
+
item_hash.each { |k, v| csv << [k, v] }
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
require 'eac_cli/runner_with/output_item/base_formatter'
|
5
|
+
require 'yaml'
|
6
|
+
|
7
|
+
module EacCli
|
8
|
+
module RunnerWith
|
9
|
+
module OutputItem
|
10
|
+
class YamlFormatter < ::EacCli::RunnerWith::OutputItem::BaseFormatter
|
11
|
+
# @return [String]
|
12
|
+
def to_output
|
13
|
+
::YAML.dump(item_hash.deep_stringify_keys)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_cli/runner_with/output'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
require 'eac_ruby_utils/acts_as_abstract'
|
6
|
+
|
7
|
+
module EacCli
|
8
|
+
module RunnerWith
|
9
|
+
module OutputItem
|
10
|
+
require_sub __FILE__
|
11
|
+
|
12
|
+
FORMATS = {
|
13
|
+
'csv' => ::EacCli::RunnerWith::OutputItem::CsvFormatter,
|
14
|
+
'yaml' => ::EacCli::RunnerWith::OutputItem::YamlFormatter
|
15
|
+
}.freeze
|
16
|
+
|
17
|
+
common_concern do
|
18
|
+
acts_as_abstract :item_hash
|
19
|
+
include ::EacCli::RunnerWith::Output
|
20
|
+
|
21
|
+
runner_definition do
|
22
|
+
arg_opt '-f', '--format', 'Format to output item.', default: 'yaml'
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
# @return [String]
|
27
|
+
def output_content
|
28
|
+
formatter.to_output
|
29
|
+
end
|
30
|
+
|
31
|
+
# @return [EacCli::RunnerWith::OutputList::BaseFormatter]
|
32
|
+
def formatter
|
33
|
+
formatter_class.new(item_hash)
|
34
|
+
end
|
35
|
+
|
36
|
+
# @return [Class]
|
37
|
+
def formatter_class
|
38
|
+
FORMATS.fetch(parsed.format)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
require 'eac_ruby_utils/acts_as_abstract'
|
5
|
+
|
6
|
+
module EacCli
|
7
|
+
module RunnerWith
|
8
|
+
module OutputList
|
9
|
+
class BaseFormatter
|
10
|
+
acts_as_abstract :to_output
|
11
|
+
common_constructor :columns, :rows
|
12
|
+
|
13
|
+
# @return [String]
|
14
|
+
def build_column(column)
|
15
|
+
column.to_s
|
16
|
+
end
|
17
|
+
|
18
|
+
# @return [Array<String>]
|
19
|
+
def build_columns
|
20
|
+
columns.map(&:to_s)
|
21
|
+
end
|
22
|
+
|
23
|
+
# @return [Array<Hash<String, String>>]
|
24
|
+
def build_rows
|
25
|
+
rows.map { |row| build_row(row) }
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'csv'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
require 'eac_cli/runner_with/output_list/base_formatter'
|
6
|
+
|
7
|
+
module EacCli
|
8
|
+
module RunnerWith
|
9
|
+
module OutputList
|
10
|
+
class CsvFormatter < ::EacCli::RunnerWith::OutputList::BaseFormatter
|
11
|
+
# @return [Array]
|
12
|
+
def build_row(row)
|
13
|
+
build_columns.map { |c| row.send(c) }
|
14
|
+
end
|
15
|
+
|
16
|
+
# @return [String]
|
17
|
+
def to_output
|
18
|
+
::CSV.generate do |csv|
|
19
|
+
csv << build_columns
|
20
|
+
build_rows.each { |row| csv << row }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
require 'eac_cli/runner_with/output_list/base_formatter'
|
5
|
+
require 'yaml'
|
6
|
+
|
7
|
+
module EacCli
|
8
|
+
module RunnerWith
|
9
|
+
module OutputList
|
10
|
+
class YamlFormatter < ::EacCli::RunnerWith::OutputList::BaseFormatter
|
11
|
+
# @return [Hash<String, String>]
|
12
|
+
def build_row(row)
|
13
|
+
build_columns.inject({}) { |a, e| a.merge(e => row.send(e).to_s) }
|
14
|
+
end
|
15
|
+
|
16
|
+
# @return [String]
|
17
|
+
def to_output
|
18
|
+
::YAML.dump(build_rows)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_cli/runner_with/output'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
require 'eac_ruby_utils/acts_as_abstract'
|
6
|
+
|
7
|
+
module EacCli
|
8
|
+
module RunnerWith
|
9
|
+
module OutputList
|
10
|
+
require_sub __FILE__
|
11
|
+
|
12
|
+
FORMATS = {
|
13
|
+
'csv' => ::EacCli::RunnerWith::OutputList::CsvFormatter,
|
14
|
+
'yaml' => ::EacCli::RunnerWith::OutputList::YamlFormatter
|
15
|
+
}.freeze
|
16
|
+
|
17
|
+
common_concern do
|
18
|
+
acts_as_abstract :list_columns, :list_rows
|
19
|
+
include ::EacCli::RunnerWith::Output
|
20
|
+
|
21
|
+
runner_definition do
|
22
|
+
arg_opt '-f', '--format', 'Format to output list.', default: 'yaml'
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
# @return [String]
|
27
|
+
def output_content
|
28
|
+
formatter.to_output
|
29
|
+
end
|
30
|
+
|
31
|
+
# @return [EacCli::RunnerWith::OutputList::BaseFormatter]
|
32
|
+
def formatter
|
33
|
+
formatter_class.new(list_columns, list_rows)
|
34
|
+
end
|
35
|
+
|
36
|
+
# @return [Class]
|
37
|
+
def formatter_class
|
38
|
+
FORMATS.fetch(parsed.format)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
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.37.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-
|
11
|
+
date: 2023-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -36,28 +36,34 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '0.
|
39
|
+
version: '0.14'
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '0.
|
46
|
+
version: '0.14'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: eac_ruby_utils
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '0.
|
53
|
+
version: '0.119'
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 0.119.1
|
54
57
|
type: :runtime
|
55
58
|
prerelease: false
|
56
59
|
version_requirements: !ruby/object:Gem::Requirement
|
57
60
|
requirements:
|
58
61
|
- - "~>"
|
59
62
|
- !ruby/object:Gem::Version
|
60
|
-
version: '0.
|
63
|
+
version: '0.119'
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: 0.119.1
|
61
67
|
- !ruby/object:Gem::Dependency
|
62
68
|
name: eac_ruby_gem_support
|
63
69
|
requirement: !ruby/object:Gem::Requirement
|
@@ -138,6 +144,14 @@ files:
|
|
138
144
|
- lib/eac_cli/runner_with/help/layout.rb
|
139
145
|
- lib/eac_cli/runner_with/input.rb
|
140
146
|
- lib/eac_cli/runner_with/output.rb
|
147
|
+
- lib/eac_cli/runner_with/output_item.rb
|
148
|
+
- lib/eac_cli/runner_with/output_item/base_formatter.rb
|
149
|
+
- lib/eac_cli/runner_with/output_item/csv_formatter.rb
|
150
|
+
- lib/eac_cli/runner_with/output_item/yaml_formatter.rb
|
151
|
+
- lib/eac_cli/runner_with/output_list.rb
|
152
|
+
- lib/eac_cli/runner_with/output_list/base_formatter.rb
|
153
|
+
- lib/eac_cli/runner_with/output_list/csv_formatter.rb
|
154
|
+
- lib/eac_cli/runner_with/output_list/yaml_formatter.rb
|
141
155
|
- lib/eac_cli/runner_with/subcommands.rb
|
142
156
|
- lib/eac_cli/runner_with/subcommands/definition_concern.rb
|
143
157
|
- lib/eac_cli/runner_with_set.rb
|