gli 2.21.2 → 2.21.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/dx/build +2 -2
- data/lib/gli/gli_option_parser.rb +4 -3
- data/lib/gli/version.rb +1 -1
- data/test/unit/gli_test.rb +39 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f66f71d97f5bb59503b88b120369d123015ae612088de9a6987ad34686bcafa
|
4
|
+
data.tar.gz: cf4bf46c072cae3e57997f0a309e7addebe288fbef32317aee374b1eaaf9859c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26b9cd9219f73b06ecd20b547b5e3cad441c7ff22099213b916780286815e6c57f8d7d1d50a0e1ff0d516ce27cf1513da36a80c52fa8d25c35e67fa5685f9a6d
|
7
|
+
data.tar.gz: 71e9d691d506a3b07a9a29d7e06988df3e798529d0a4ae4cad1ff08070537df6506d3306ed94095c4109e3740ce9b7c7aceb7a92c0540a493b847d1348418874
|
data/dx/build
CHANGED
@@ -35,7 +35,7 @@ log "✨" "Creating docker-compose.dx.yml"
|
|
35
35
|
compose_file="docker-compose.dx.yml"
|
36
36
|
log "🗑️" "Deleting previous ${compose_file}"
|
37
37
|
|
38
|
-
rm "${compose_file}"
|
38
|
+
rm -f "${compose_file}"
|
39
39
|
echo "# THIS IS GENERATED - DO NOT EDIT" > "${compose_file}"
|
40
40
|
echo "" >> "${compose_file}"
|
41
41
|
echo "services:" >> "${compose_file}"
|
@@ -54,7 +54,7 @@ for ruby_version in ${RUBY_VERSIONS[@]}; do
|
|
54
54
|
echo " entrypoint: /root/show-help-in-app-container-then-wait.sh" >> "${compose_file}"
|
55
55
|
echo " working_dir: /root/work" >> "${compose_file}"
|
56
56
|
done
|
57
|
-
log "🎼" "${compose_file} is
|
57
|
+
log "🎼" "${compose_file} is now created"
|
58
58
|
log "🔄" "You can run dx/start to start it up, though you may need to stop it first with Ctrl-C"
|
59
59
|
|
60
60
|
# vim: ft=bash
|
@@ -109,9 +109,10 @@ module GLI
|
|
109
109
|
def verify_required_options!(flags, command, options)
|
110
110
|
missing_required_options = flags.values.
|
111
111
|
select(&:required?).
|
112
|
-
|
113
|
-
options[option.name]
|
114
|
-
|
112
|
+
select { |option|
|
113
|
+
options[option.name] == nil ||
|
114
|
+
( options[option.name].kind_of?(Array) && options[option.name].empty? )
|
115
|
+
}
|
115
116
|
unless missing_required_options.empty?
|
116
117
|
missing_required_options.sort!
|
117
118
|
raise MissingRequiredArgumentsException.new(missing_required_options.map { |option|
|
data/lib/gli/version.rb
CHANGED
data/test/unit/gli_test.rb
CHANGED
@@ -81,6 +81,25 @@ class GLITest < Minitest::Test
|
|
81
81
|
|
82
82
|
end
|
83
83
|
|
84
|
+
def test_command_options_accepting_multiple_values_can_be_required
|
85
|
+
@app.reset
|
86
|
+
@called = false
|
87
|
+
@app.command :foo do |c|
|
88
|
+
c.flag :flag, :required => true, :multiple => true
|
89
|
+
c.action do |global, options, arguments|
|
90
|
+
@called = true
|
91
|
+
end
|
92
|
+
end
|
93
|
+
assert_equal 64, @app.run(['foo']), "Expected exit status to be 64"
|
94
|
+
assert @fake_stderr.contained?(/flag is required/), @fake_stderr.strings.inspect
|
95
|
+
assert @fake_stderr.contained?(/flag is required/), @fake_stderr.strings.inspect
|
96
|
+
assert !@called
|
97
|
+
|
98
|
+
assert_equal 0, @app.run(['foo','--flag=bar']), "Expected exit status to be 0 #{@fake_stderr.strings.join(',')}"
|
99
|
+
assert @called
|
100
|
+
|
101
|
+
end
|
102
|
+
|
84
103
|
def test_global_options_can_be_required
|
85
104
|
@app.reset
|
86
105
|
@called = false
|
@@ -102,6 +121,25 @@ class GLITest < Minitest::Test
|
|
102
121
|
|
103
122
|
end
|
104
123
|
|
124
|
+
def test_global_options_accepting_multiple_can_be_required
|
125
|
+
@app.reset
|
126
|
+
@called = false
|
127
|
+
@app.flag :flag, :required => true, :multiple => true
|
128
|
+
@app.command :foo do |c|
|
129
|
+
c.action do |global, options, arguments|
|
130
|
+
@called = true
|
131
|
+
end
|
132
|
+
end
|
133
|
+
assert_equal 64, @app.run(['foo']), "Expected exit status to be 64"
|
134
|
+
assert @fake_stderr.contained?(/flag is required/), @fake_stderr.strings.inspect
|
135
|
+
assert @fake_stderr.contained?(/flag is required/), @fake_stderr.strings.inspect
|
136
|
+
assert !@called
|
137
|
+
|
138
|
+
assert_equal 0, @app.run(['--flag=bar','foo']), "Expected exit status to be 0 #{@fake_stderr.strings.join(',')}"
|
139
|
+
assert @called
|
140
|
+
|
141
|
+
end
|
142
|
+
|
105
143
|
def test_global_required_options_are_ignored_on_help
|
106
144
|
@app.reset
|
107
145
|
@called = false
|
@@ -161,6 +199,7 @@ class GLITest < Minitest::Test
|
|
161
199
|
raise failure if !failure.nil?
|
162
200
|
end
|
163
201
|
|
202
|
+
|
164
203
|
def test_command_line_overrides_config
|
165
204
|
failure = nil
|
166
205
|
@app.reset
|