eac_cli 0.12.2 → 0.12.3
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/parser.rb +6 -4
- data/lib/eac_cli/parser/alternative.rb +4 -0
- data/lib/eac_cli/runner.rb +10 -2
- data/lib/eac_cli/runner/exit.rb +13 -0
- data/lib/eac_cli/runner_with/help.rb +15 -0
- data/lib/eac_cli/runner_with/subcommands.rb +1 -1
- 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: fdd062e7481cd022e3706681b1fccae579efc2ecab9378cca76871008d75d89f
|
4
|
+
data.tar.gz: b33f0432da0acd199ff02df511708a9eb56423d5b3fbc2a784b340a8eace9748
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60b05d12fb2ea5c787193575a10fac4bead0f9177a75cf39e9dcbefe230d033412b58e2f164112eea1b2add9a95b55f8caf8f7d74831f79e0aa09f6c6889dcb8
|
7
|
+
data.tar.gz: c4b0d9cf8829b9c18a2d67e7986f187e1797fd7bc6448435534218b9bfa9be3e574adc6a1b3d278a016dc6194b8cbaf569a35f6025f2c0a036cd69ec4b54a420
|
data/lib/eac_cli/parser.rb
CHANGED
@@ -12,12 +12,14 @@ module EacCli
|
|
12
12
|
|
13
13
|
def parsed_uncached
|
14
14
|
raise 'Definition has no alternatives' if alternatives.empty?
|
15
|
+
raise first_error unless alternatives.select(&:success?).any?
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
end
|
17
|
+
alternatives_parsed(true).merge(alternatives_parsed(false))
|
18
|
+
end
|
19
19
|
|
20
|
-
|
20
|
+
def alternatives_parsed(error)
|
21
|
+
alternatives.select { |a| error == a.error? }.map(&:parsed).reverse
|
22
|
+
.inject(::EacRubyUtils::Struct.new) { |a, e| a.merge(e) }
|
21
23
|
end
|
22
24
|
|
23
25
|
def alternatives_uncached
|
data/lib/eac_cli/runner.rb
CHANGED
@@ -44,6 +44,8 @@ module EacCli
|
|
44
44
|
extend AfterClassMethods
|
45
45
|
include InstanceMethods
|
46
46
|
::EacCli::Docopt::RunnerExtension.check(self)
|
47
|
+
include ActiveSupport::Callbacks
|
48
|
+
define_callbacks :run
|
47
49
|
end
|
48
50
|
|
49
51
|
module AfterClassMethods
|
@@ -55,8 +57,7 @@ module EacCli
|
|
55
57
|
|
56
58
|
def run(*runner_context_args)
|
57
59
|
r = create(*runner_context_args)
|
58
|
-
r.
|
59
|
-
r.run
|
60
|
+
r.run_run
|
60
61
|
r
|
61
62
|
end
|
62
63
|
|
@@ -72,6 +73,13 @@ module EacCli
|
|
72
73
|
end
|
73
74
|
|
74
75
|
module InstanceMethods
|
76
|
+
def run_run
|
77
|
+
parsed
|
78
|
+
run_callbacks(:run) { run }
|
79
|
+
rescue ::EacCli::Runner::Exit # rubocop:disable Lint/SuppressedException
|
80
|
+
# Do nothing
|
81
|
+
end
|
82
|
+
|
75
83
|
def runner_context
|
76
84
|
return @runner_context if @runner_context
|
77
85
|
|
@@ -13,6 +13,21 @@ module EacCli
|
|
13
13
|
options_argument false
|
14
14
|
bool_opt '-h', '--help', 'Show help.', usage: true
|
15
15
|
end
|
16
|
+
|
17
|
+
set_callback :run, :before do
|
18
|
+
help_run
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def help_run
|
23
|
+
return unless parsed.help?
|
24
|
+
|
25
|
+
puts help_text
|
26
|
+
raise ::EacCli::Runner::Exit
|
27
|
+
end
|
28
|
+
|
29
|
+
def help_text
|
30
|
+
::EacCli::Docopt::DocBuilder.new(self.class.runner_definition).to_s
|
16
31
|
end
|
17
32
|
end
|
18
33
|
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.12.
|
4
|
+
version: 0.12.3
|
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: 2020-12-
|
11
|
+
date: 2020-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: eac_ruby_utils
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.55'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0.
|
26
|
+
version: '0.55'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: eac_ruby_gem_support
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -77,6 +77,7 @@ files:
|
|
77
77
|
- lib/eac_cli/patches/object/runner_with.rb
|
78
78
|
- lib/eac_cli/runner.rb
|
79
79
|
- lib/eac_cli/runner/context.rb
|
80
|
+
- lib/eac_cli/runner/exit.rb
|
80
81
|
- lib/eac_cli/runner_with.rb
|
81
82
|
- lib/eac_cli/runner_with/help.rb
|
82
83
|
- lib/eac_cli/runner_with/output_file.rb
|