eac_cli 0.23.1 → 0.24.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/enum.rb +45 -0
- data/lib/eac_cli/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc8e1deef8fb47d7b6be3be4e36fcdcb11bf0894640dc1f0ee53aa6f70bfe3d3
|
4
|
+
data.tar.gz: 7b025fa00666ee9920bb67bccf27323e7e33972dd9bea32ebcbd16bc25079552
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1872da57767aa71230e4a115448b1e273447c4becdd03abc940b6b805ff57bae1940f87956aa6764cae8180e0fbea995380be1517b2ebd4514bae4e7e109751
|
7
|
+
data.tar.gz: 133f99ec750e162c143bab01f49d4dd9a1fece25c14797444f264027983da01a671cf024e6a19346c2043296cfdf39e59c244434ab39343c4201e0432b1892f3
|
data/lib/eac_cli/enum.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/enum'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
|
6
|
+
module EacCli
|
7
|
+
# A [EacRubyUtils::Enum] which each value is associated with one console color.
|
8
|
+
class Enum < ::EacRubyUtils::Enum
|
9
|
+
# Foreground color used in [to_bg_label]
|
10
|
+
TO_BG_LABEL_FG_COLOR = :light_white
|
11
|
+
|
12
|
+
attr_reader :color
|
13
|
+
|
14
|
+
def initialize(key, color)
|
15
|
+
super(key)
|
16
|
+
@color = color
|
17
|
+
end
|
18
|
+
|
19
|
+
delegate :to_s, to: :key
|
20
|
+
|
21
|
+
# @return [String]
|
22
|
+
def to_label
|
23
|
+
to_fg_label
|
24
|
+
end
|
25
|
+
|
26
|
+
# @return [String]
|
27
|
+
def to_fg_label
|
28
|
+
to_fg_bg_label(color)
|
29
|
+
end
|
30
|
+
|
31
|
+
# @return [String]
|
32
|
+
def to_bg_label
|
33
|
+
to_fg_bg_label(TO_BG_LABEL_FG_COLOR, color)
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
# @return [String]
|
39
|
+
def to_fg_bg_label(fg_color, bg_color = nil)
|
40
|
+
colors = { color: fg_color }
|
41
|
+
bg_color.if_present { |v| colors[:background] = v }
|
42
|
+
::ColorizedString[to_s].colorize(colors)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
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.24.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: 2021-
|
11
|
+
date: 2021-11-21 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.80'
|
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.80'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: eac_ruby_gem_support
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,6 +94,7 @@ files:
|
|
94
94
|
- lib/eac_cli/definition/boolean_option.rb
|
95
95
|
- lib/eac_cli/definition/help_formatter.rb
|
96
96
|
- lib/eac_cli/definition/positional_argument.rb
|
97
|
+
- lib/eac_cli/enum.rb
|
97
98
|
- lib/eac_cli/old_configs.rb
|
98
99
|
- lib/eac_cli/old_configs/entry_reader.rb
|
99
100
|
- lib/eac_cli/old_configs/password_entry_reader.rb
|