File tree Expand file tree Collapse file tree 5 files changed +18
-13
lines changed Expand file tree Collapse file tree 5 files changed +18
-13
lines changed Original file line number Diff line number Diff line change @@ -21,13 +21,13 @@ def default_string
2121 end
2222 end
2323
24- def usage_string
25- required ? label : "[#{ label } ]"
26- end
27-
2824 def label
2925 repeatable ? "#{ name . upcase } ..." : name . upcase
3026 end
27+
28+ def usage_string
29+ required ? label : "[#{ label } ]"
30+ end
3131 end
3232 end
3333end
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ class EnvironmentVariable < Base
66 class << self
77 def option_keys
88 @option_keys ||= %i[
9- allowed default help name required private validate
9+ allowed default help name private required validate
1010 ]
1111 end
1212 end
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ class << self
1010 def option_keys
1111 @option_keys ||= %i[
1212 allowed arg completions conflicts default help long needs
13- repeatable required short unique validate private
13+ private repeatable required short unique validate
1414 ]
1515 end
1616 end
Original file line number Diff line number Diff line change @@ -14,10 +14,12 @@ if validate
1414 > done
1515 > fi
1616 else
17- > validation_output="$(validate_{{ validate }} "${args['{{ name }}']:-}")"
18- > if [[ -v args['{{ name }}'] && -n "$validation_output" ]]; then
19- > printf "{{ strings[:validation_error] }}\n" "{{ name.upcase }}" "$validation_output" >&2
20- > exit 1
17+ > if [[ -v args['{{ name }}'] ]]; then
18+ > validation_output="$(validate_{{ validate }} "${args['{{ name }}']:-}")"
19+ > if [[ -n "$validation_output" ]]; then
20+ > printf "{{ strings[:validation_error] }}\n" "{{ name.upcase }}" "$validation_output" >&2
21+ > exit 1
22+ > fi
2123 > fi
2224 >
2325 end
Original file line number Diff line number Diff line change 11if validate
22 = view_marker
33
4- > if [[ -v {{ name.upcase }} && -n $(validate_{{ validate }} "${{ name.upcase }}") ]]; then
5- > printf "{{ strings[:environment_variable_validation_error] }}\n" "{{ usage_string }}" "$(validate_{{ validate }} "${{ name.upcase }}")" >&2
6- > exit 1
4+ > if [[ -v {{ name.upcase }} ]]; then
5+ > validation_output="$(validate_{{ validate }} "${{ name.upcase }}")"
6+ > if [[ -n "${validation_output}" ]]; then
7+ > printf "{{ strings[:environment_variable_validation_error] }}\n" "{{ usage_string }}" "$validation_output" >&2
8+ > exit 1
9+ > fi
710 > fi
811 >
912end
You can’t perform that action at this time.
0 commit comments