eac_cli 0.39.0 → 0.40.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ece27189a8fbfde6ada6b7b3b1bbe78a57dd47cd2df0eba8cd1551fe94b5cee
|
4
|
+
data.tar.gz: 77046ab0fcdc365df212cfe028e953eec75d82f2ed0f4b7f148d62635d7a783f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 825723db43e762a7445d7ba56e7c61fc9125d5355209608112009137937f43679cd460b9c45fcbcbd808a34db7f3986b257618ba6e702aa33ff01946f6251e8a
|
7
|
+
data.tar.gz: 843805718a773a90e3dc1030127bc4db0c073f4f304bd0c6b2140177697c74becebccfa755412f048528f30af9e362775b1cda7e87f73132c5d348b81b9ac182
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module EacCli
|
6
|
+
module RunnerWith
|
7
|
+
module Confirmation
|
8
|
+
class InputResult
|
9
|
+
INPUT_NO_FOR_ONE = 'n'
|
10
|
+
INPUT_NO_FOR_ALL = 'N'
|
11
|
+
INPUT_YES_FOR_ONE = 'y'
|
12
|
+
INPUT_YES_FOR_ALL = 'Y'
|
13
|
+
INPUT_FOR_ONE = [INPUT_NO_FOR_ONE, INPUT_YES_FOR_ONE].freeze
|
14
|
+
INPUT_FOR_ALL = [INPUT_NO_FOR_ALL, INPUT_YES_FOR_ALL].freeze
|
15
|
+
INPUT_NO = [INPUT_NO_FOR_ONE, INPUT_NO_FOR_ALL].freeze
|
16
|
+
INPUT_YES = [INPUT_YES_FOR_ONE, INPUT_YES_FOR_ALL].freeze
|
17
|
+
INPUT_LIST = [INPUT_NO_FOR_ALL, INPUT_NO_FOR_ONE, INPUT_YES_FOR_ONE, INPUT_YES_FOR_ALL]
|
18
|
+
.freeze
|
19
|
+
|
20
|
+
class << self
|
21
|
+
enable_speaker
|
22
|
+
|
23
|
+
# @param message [String]
|
24
|
+
# @return [EacCli::RunnerWith::Confirmation::InputResult]
|
25
|
+
def by_message(message)
|
26
|
+
new(input(message, list: INPUT_LIST))
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
common_constructor :input_value
|
31
|
+
|
32
|
+
# @return [Boolean]
|
33
|
+
def confirm?
|
34
|
+
input_value_to_bool(INPUT_NO, INPUT_YES)
|
35
|
+
end
|
36
|
+
|
37
|
+
# @return [Boolean]
|
38
|
+
def for_all?
|
39
|
+
input_value_to_bool(INPUT_FOR_ONE, INPUT_FOR_ALL)
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
# @param false_list [Array<String>]
|
45
|
+
# @param true_list [Array<String>]
|
46
|
+
# @return [Boolean]
|
47
|
+
def input_value_to_bool(false_list, true_list)
|
48
|
+
return false if false_list.include?(input_value)
|
49
|
+
return true if true_list.include?(input_value)
|
50
|
+
|
51
|
+
ibr input_value
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -19,13 +19,13 @@ module EacCli
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def confirm?(message = nil)
|
22
|
+
return for_all_answers.fetch(message) if for_all_answers.key?(message)
|
22
23
|
return false if parsed.no?
|
23
24
|
return true if parsed.yes?
|
24
25
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
)
|
26
|
+
r = confirm_input(message)
|
27
|
+
for_all_answers[message] = r.for_all?
|
28
|
+
r.confirm?
|
29
29
|
rescue ::EacCli::Speaker::InputRequested => e
|
30
30
|
fatal_error e.message
|
31
31
|
end
|
@@ -39,6 +39,21 @@ module EacCli
|
|
39
39
|
def cached_confirm_uncached?(message = nil)
|
40
40
|
confirm?(message)
|
41
41
|
end
|
42
|
+
|
43
|
+
# @param message [String, nil]
|
44
|
+
# @return [Boolean]
|
45
|
+
def confirm_input(message)
|
46
|
+
::EacCli::RunnerWith::Confirmation::InputResult.by_message(
|
47
|
+
message || setting_value(:confirm_question_text, default: DEFAULT_CONFIRM_QUESTION_TEXT)
|
48
|
+
)
|
49
|
+
end
|
50
|
+
|
51
|
+
# @return [Hash<String, Boolean>]
|
52
|
+
def for_all_answers_uncached
|
53
|
+
{}
|
54
|
+
end
|
55
|
+
|
56
|
+
require_sub __FILE__
|
42
57
|
end
|
43
58
|
end
|
44
59
|
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.40.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-
|
11
|
+
date: 2023-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -56,20 +56,14 @@ dependencies:
|
|
56
56
|
requirements:
|
57
57
|
- - "~>"
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version: '0.
|
60
|
-
- - ">="
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: 0.119.2
|
59
|
+
version: '0.120'
|
63
60
|
type: :runtime
|
64
61
|
prerelease: false
|
65
62
|
version_requirements: !ruby/object:Gem::Requirement
|
66
63
|
requirements:
|
67
64
|
- - "~>"
|
68
65
|
- !ruby/object:Gem::Version
|
69
|
-
version: '0.
|
70
|
-
- - ">="
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
version: 0.119.2
|
66
|
+
version: '0.120'
|
73
67
|
- !ruby/object:Gem::Dependency
|
74
68
|
name: tty-table
|
75
69
|
requirement: !ruby/object:Gem::Requirement
|
@@ -159,6 +153,7 @@ files:
|
|
159
153
|
- lib/eac_cli/runner/instance_methods.rb
|
160
154
|
- lib/eac_cli/runner_with.rb
|
161
155
|
- lib/eac_cli/runner_with/confirmation.rb
|
156
|
+
- lib/eac_cli/runner_with/confirmation/input_result.rb
|
162
157
|
- lib/eac_cli/runner_with/help.rb
|
163
158
|
- lib/eac_cli/runner_with/help/builder.rb
|
164
159
|
- lib/eac_cli/runner_with/help/builder/alternative.rb
|