ace-support-cli 0.6.5 → 0.6.7
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/CHANGELOG.md +10 -0
- data/lib/ace/support/cli/command.rb +3 -2
- data/lib/ace/support/cli/help/banner.rb +14 -1
- data/lib/ace/support/cli/models/option.rb +3 -2
- data/lib/ace/support/cli/parser.rb +7 -1
- data/lib/ace/support/cli/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: dffb8ed525e3e2a4e8c779b1c320cb3d9445c10bd9f2c5587f681b743dc54e66
|
|
4
|
+
data.tar.gz: 284d72fb8c5de3ceaebde702ce3dd5dee21740174d7f4a19055b306cad08ac9c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e11affb46f531af49fe99bc27394cac530ff53b4de1c42085c70ab0dcb7eb0284d3cca0c1c08a5efdd99b15f3084e0ce58efb593bd72222035ad1e86bcfa4a67
|
|
7
|
+
data.tar.gz: 101c391ba4b4088c530a6da9f467123cfa073a63d2ebeb6a693bdf5d0be99dc2b606c704b1c63ef7ac5ec1753922008928c14cbafb9f51b470f1f956e0e0370a
|
data/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.6.7] - 2026-04-16
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
- Hid misleading rich-help `(default: false)` output for optional-value flags so shorthand CLI forms like bare `--capture` and `--wait` are documented accurately.
|
|
11
|
+
|
|
12
|
+
## [0.6.6] - 2026-04-16
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
- Added optional-value string flag parsing so ACE CLIs can accept shorthand forms like bare `--capture` without breaking existing option and positional parsing behavior.
|
|
16
|
+
|
|
7
17
|
## [0.6.5] - 2026-04-13
|
|
8
18
|
|
|
9
19
|
### Changed
|
|
@@ -22,7 +22,7 @@ module Ace
|
|
|
22
22
|
@description = text
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
def option(name, type: :string, default: nil, desc: "", aliases: [], values: nil, required: false, repeat: false, **_extra)
|
|
25
|
+
def option(name, type: :string, default: nil, desc: "", aliases: [], values: nil, required: false, repeat: false, optional_value: false, **_extra)
|
|
26
26
|
@options ||= []
|
|
27
27
|
@options << Models::Option.new(
|
|
28
28
|
name: name,
|
|
@@ -32,7 +32,8 @@ module Ace
|
|
|
32
32
|
aliases: aliases,
|
|
33
33
|
values: values,
|
|
34
34
|
required: required,
|
|
35
|
-
repeat: repeat
|
|
35
|
+
repeat: repeat,
|
|
36
|
+
optional_value: optional_value
|
|
36
37
|
)
|
|
37
38
|
end
|
|
38
39
|
|
|
@@ -103,7 +103,7 @@ module Ace
|
|
|
103
103
|
values = option_values(option)
|
|
104
104
|
details << "(values: #{Array(values).join(", ")})" if values && !Array(values).empty?
|
|
105
105
|
default = option_default(option)
|
|
106
|
-
details << "(default: #{default.inspect})" unless default
|
|
106
|
+
details << "(default: #{default.inspect})" unless suppress_default_display?(option, default)
|
|
107
107
|
details << "(required)" if option_required?(option)
|
|
108
108
|
|
|
109
109
|
return label if details.empty?
|
|
@@ -204,6 +204,19 @@ module Ace
|
|
|
204
204
|
false
|
|
205
205
|
end
|
|
206
206
|
|
|
207
|
+
def self.option_optional_value?(option)
|
|
208
|
+
return option.optional_value if option.respond_to?(:optional_value)
|
|
209
|
+
|
|
210
|
+
false
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
def self.suppress_default_display?(option, default)
|
|
214
|
+
return true if default.nil?
|
|
215
|
+
return true if option_optional_value?(option) && default == false
|
|
216
|
+
|
|
217
|
+
false
|
|
218
|
+
end
|
|
219
|
+
|
|
207
220
|
def self.option_boolean?(option)
|
|
208
221
|
return option.boolean? if option.respond_to?(:boolean?)
|
|
209
222
|
|
|
@@ -7,9 +7,9 @@ module Ace
|
|
|
7
7
|
class Option
|
|
8
8
|
VALID_TYPES = %i[string integer float boolean array hash].freeze
|
|
9
9
|
|
|
10
|
-
attr_reader :name, :type, :default, :desc, :aliases, :values, :required, :repeat
|
|
10
|
+
attr_reader :name, :type, :default, :desc, :aliases, :values, :required, :repeat, :optional_value
|
|
11
11
|
|
|
12
|
-
def initialize(name:, type: :string, default: nil, desc: "", aliases: [], values: nil, required: false, repeat: false)
|
|
12
|
+
def initialize(name:, type: :string, default: nil, desc: "", aliases: [], values: nil, required: false, repeat: false, optional_value: false)
|
|
13
13
|
@name = name.to_sym
|
|
14
14
|
@type = type.to_sym
|
|
15
15
|
@default = default
|
|
@@ -18,6 +18,7 @@ module Ace
|
|
|
18
18
|
@values = values
|
|
19
19
|
@required = required
|
|
20
20
|
@repeat = repeat
|
|
21
|
+
@optional_value = optional_value
|
|
21
22
|
validate!
|
|
22
23
|
end
|
|
23
24
|
|
|
@@ -115,7 +115,7 @@ module Ace
|
|
|
115
115
|
options[option.name] = current.merge(key => parsed_value)
|
|
116
116
|
end
|
|
117
117
|
else
|
|
118
|
-
switches = value_switches(option, "VALUE")
|
|
118
|
+
switches = option.optional_value ? optional_value_switches(option, "VALUE") : value_switches(option, "VALUE")
|
|
119
119
|
parser.on(*switches, String, desc) { |value| assign_option_value(options, option, value) }
|
|
120
120
|
end
|
|
121
121
|
end
|
|
@@ -136,6 +136,12 @@ module Ace
|
|
|
136
136
|
end
|
|
137
137
|
end
|
|
138
138
|
|
|
139
|
+
def optional_value_switches(option, value_label)
|
|
140
|
+
(option.aliases + [option.long_switch]).map do |switch|
|
|
141
|
+
"#{switch} [#{value_label}]"
|
|
142
|
+
end
|
|
143
|
+
end
|
|
144
|
+
|
|
139
145
|
def parse_hash_pair(value, option)
|
|
140
146
|
parts = value.split(/[=:]/, 2)
|
|
141
147
|
raise ArgumentError, "Invalid value for #{option.long_switch}: expected key=value" if parts.length < 2
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ace-support-cli
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.6.
|
|
4
|
+
version: 0.6.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Michal Czyz
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-04-
|
|
10
|
+
date: 2026-04-26 00:00:00.000000000 Z
|
|
11
11
|
dependencies: []
|
|
12
12
|
description: Provides command DSL, option parsing, registry routing, and runner primitives
|
|
13
13
|
for ACE CLI tools.
|