eac_cli 0.18.0 → 0.19.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 24ca129d2aa0ed0babd8928e4f3d2b20462566e0a3bc88e1255ba63513e11442
4
- data.tar.gz: 249aa6c5592be11f6e831972342f5be95b9783524df4176616e643b44fdacac3
3
+ metadata.gz: cfee9c78c899be3c4e2d36915e4d0cac08cf5f2a63269813b5c05527a06d0e75
4
+ data.tar.gz: c0374336ed9fea6c351ce00b0a9e5e210b53ca7a34c201dc1a0699fcda12b943
5
5
  SHA512:
6
- metadata.gz: 645a80ceb7ef1af1444f88c753eeb2034cac3e78d6eb6a192103c4eb507c35f8b51756a9ba1f30ba25b8770cf61f74d7cb46341571946479943c7805873b5c46
7
- data.tar.gz: 594439ed558f99ebe910faa4b060b32a0916479d92baa230fd2fac5e61da4f0f8557fed270978cd7ee62db577454fd53ab0acdc7da2ffebae709f47613dfb0c2
6
+ metadata.gz: d2e1c8009e10490cde982e4d8cc0fce02d67d0114ddb3a852180298c6f83edd7d5e4e2ee0bf04188199d615739297b3fdbf41a61d532e6614b86dece3c63b864
7
+ data.tar.gz: fba7139e87ea3959a2498f20d83a08d19c299acd71e576ed0d446ca47a77bb97ab9e670c4280984001feb6467d6cdd01d3a989dc6b44b5e4d5345d9f87c66a0c
@@ -26,6 +26,8 @@ module EacCli
26
26
  input_value
27
27
  end
28
28
 
29
+ delegate :value=, to: :sub_entry
30
+
29
31
  private
30
32
 
31
33
  def sub_value_to_return
@@ -6,9 +6,10 @@ module EacCli
6
6
  class Definition
7
7
  class PositionalArgument
8
8
  DEFAULT_REQUIRED = true
9
+ DEFAULT_VISIBLE = true
9
10
 
10
11
  enable_listable
11
- lists.add_symbol :option, :optional, :repeat, :required, :subcommand
12
+ lists.add_symbol :option, :optional, :repeat, :required, :subcommand, :visible
12
13
  common_constructor :name, :options, default: [{}] do
13
14
  options.assert_valid_keys(self.class.lists.option.values)
14
15
  end
@@ -51,6 +52,10 @@ module EacCli
51
52
  def to_s
52
53
  "#{self.class.name.demodulize}[#{identifier}]"
53
54
  end
55
+
56
+ def visible?
57
+ options.key?(OPTION_VISIBLE) ? options.fetch(OPTION_VISIBLE) : DEFAULT_VISIBLE
58
+ end
54
59
  end
55
60
  end
56
61
  end
@@ -31,10 +31,12 @@ module EacCli
31
31
  end
32
32
 
33
33
  def positionals
34
- alternative.positional.map { |p| positional(p) }
34
+ alternative.positional.map { |p| positional(p) }.reject(&:blank?)
35
35
  end
36
36
 
37
37
  def positional(positional)
38
+ return unless positional.visible?
39
+
38
40
  if positional.subcommand?
39
41
  ::EacCli::DocoptRunner::SUBCOMMANDS_MACRO
40
42
  else
@@ -10,8 +10,8 @@ module EacCli
10
10
  include ::EacCli::Runner
11
11
 
12
12
  runner_definition.alt do
13
- options_argument false
14
13
  bool_opt '-h', '--help', 'Show help.', usage: true
14
+ pos_arg :any_arg_with_help, repeat: true, optional: true, visible: false
15
15
  end
16
16
 
17
17
  set_callback :run, :before do
@@ -20,7 +20,7 @@ module EacCli
20
20
  end
21
21
 
22
22
  def help_run
23
- return unless parsed.help?
23
+ return unless show_help?
24
24
 
25
25
  puts help_text
26
26
  raise ::EacCli::Runner::Exit
@@ -31,6 +31,10 @@ module EacCli
31
31
  r += help_extra_text if respond_to?(:help_extra_text)
32
32
  r
33
33
  end
34
+
35
+ def show_help?
36
+ parsed.help? && !if_respond(:run_subcommand?, false)
37
+ end
34
38
  end
35
39
  end
36
40
  end
@@ -60,7 +60,7 @@ module EacCli
60
60
  end
61
61
 
62
62
  def run_with_subcommand
63
- if subcommand_name
63
+ if run_subcommand?
64
64
  if subcommand_runner.respond_to?(:run_run)
65
65
  subcommand_runner.run_run
66
66
  else
@@ -79,6 +79,10 @@ module EacCli
79
79
  "Method #{__method__} should be overrided in #{self.class.name}"
80
80
  end
81
81
 
82
+ def run_subcommand?
83
+ subcommand_name.present?
84
+ end
85
+
82
86
  def subcommands?
83
87
  self.class.runner_definition.subcommands?
84
88
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacCli
4
- VERSION = '0.18.0'
4
+ VERSION = '0.19.0'
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.18.0
4
+ version: 0.19.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-06-01 00:00:00.000000000 Z
11
+ date: 2021-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize