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
21
21
end
22
22
end
23
23
24
- def usage_string
25
- required ? label : "[#{ label } ]"
26
- end
27
-
28
24
def label
29
25
repeatable ? "#{ name . upcase } ..." : name . upcase
30
26
end
27
+
28
+ def usage_string
29
+ required ? label : "[#{ label } ]"
30
+ end
31
31
end
32
32
end
33
33
end
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ class EnvironmentVariable < Base
6
6
class << self
7
7
def option_keys
8
8
@option_keys ||= %i[
9
- allowed default help name required private validate
9
+ allowed default help name private required validate
10
10
]
11
11
end
12
12
end
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ class << self
10
10
def option_keys
11
11
@option_keys ||= %i[
12
12
allowed arg completions conflicts default help long needs
13
- repeatable required short unique validate private
13
+ private repeatable required short unique validate
14
14
]
15
15
end
16
16
end
Original file line number Diff line number Diff line change @@ -14,10 +14,12 @@ if validate
14
14
> done
15
15
> fi
16
16
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
21
23
> fi
22
24
>
23
25
end
Original file line number Diff line number Diff line change 1
1
if validate
2
2
= view_marker
3
3
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
7
10
> fi
8
11
>
9
12
end
You can’t perform that action at this time.
0 commit comments