File tree Expand file tree Collapse file tree 7 files changed +50
-15
lines changed Expand file tree Collapse file tree 7 files changed +50
-15
lines changed Original file line number Diff line number Diff line change @@ -23,10 +23,12 @@ name: cli
23
23
help : Sample application demonstrating the use of variables
24
24
version : 0.1.0
25
25
26
- # The `build_number` variable will be available globally
26
+ # The `build_number` and `environments` variables will be available globally
27
27
variables :
28
28
- name : build_number
29
29
value : 1337
30
+ - name : environments
31
+ value : [dev, stage, production]
30
32
31
33
commands :
32
34
- name : download
@@ -70,6 +72,10 @@ echo "download_sources:"
70
72
for value in "${download_sources[@]}"; do
71
73
echo "- $value"
72
74
done
75
+ echo "environments:"
76
+ for value in "${environments[@]}"; do
77
+ echo "- $value"
78
+ done
73
79
````
74
80
75
81
## ` src/compress_command.sh `
@@ -80,7 +86,10 @@ echo "zip_options:"
80
86
for key in " ${! zip_options[@]} " ; do
81
87
echo " $key : ${zip_options[$key]} "
82
88
done
83
-
89
+ echo " environments:"
90
+ for value in " ${environments[@]} " ; do
91
+ echo " - $value "
92
+ done
84
93
````
85
94
86
95
@@ -94,6 +103,10 @@ output_folder: output
94
103
download_sources:
95
104
- youtube
96
105
- instagram
106
+ environments:
107
+ - dev
108
+ - stage
109
+ - production
97
110
98
111
99
112
````
@@ -105,6 +118,10 @@ build_number: 1337
105
118
zip_options:
106
119
compression_level: fast
107
120
pattern: * .json
121
+ environments:
122
+ - dev
123
+ - stage
124
+ - production
108
125
109
126
110
127
````
Original file line number Diff line number Diff line change @@ -2,10 +2,12 @@ name: cli
2
2
help : Sample application demonstrating the use of variables
3
3
version : 0.1.0
4
4
5
- # The `build_number` variable will be available globally
5
+ # The `build_number` and `environments` variables will be available globally
6
6
variables :
7
7
- name : build_number
8
8
value : 1337
9
+ - name : environments
10
+ value : [dev, stage, production]
9
11
10
12
commands :
11
13
- name : download
Original file line number Diff line number Diff line change @@ -3,3 +3,7 @@ echo "zip_options:"
3
3
for key in " ${! zip_options[@]} " ; do
4
4
echo " $key : ${zip_options[$key]} "
5
5
done
6
+ echo " environments:"
7
+ for value in " ${environments[@]} " ; do
8
+ echo " - $value "
9
+ done
Original file line number Diff line number Diff line change @@ -3,4 +3,8 @@ echo "output_folder: $output_folder"
3
3
echo " download_sources:"
4
4
for value in " ${download_sources[@]} " ; do
5
5
echo " - $value "
6
+ done
7
+ echo " environments:"
8
+ for value in " ${environments[@]} " ; do
9
+ echo " - $value "
6
10
done
Original file line number Diff line number Diff line change 1
1
= view_marker
2
2
3
3
> run() {
4
- > declare -A args=()
5
- > declare -A deps=()
6
- > declare -a other_args=()
7
- > declare -a env_var_names=()
8
- > declare -a input=()
4
+ > declare -g - A args=()
5
+ > declare -g - A deps=()
6
+ > declare -g - a other_args=()
7
+ > declare -g - a env_var_names=()
8
+ > declare -g - a input=()
9
9
if has_unique_args_or_flags?
10
- > declare -A unique_lookup=()
10
+ > declare -g - A unique_lookup=()
11
11
end
12
12
> normalize_input "$@"
13
13
> parse_requirements "${input[@]}"
Original file line number Diff line number Diff line change 3
3
case value
4
4
when Array
5
5
if value.empty?
6
- > declare -a {{ name }}=()
6
+ > declare -g - a {{ name }}=()
7
7
else
8
- > declare -a {{ name }}=(
8
+ > declare -g - a {{ name }}=(
9
9
value.each do |v|
10
10
> "{{ v }}"
11
11
end
12
12
> )
13
13
end
14
14
when Hash
15
15
if value.empty?
16
- > declare -A {{ name }}=()
16
+ > declare -g - A {{ name }}=()
17
17
else
18
- > declare -A {{ name }}=(
18
+ > declare -g - A {{ name }}=(
19
19
value.each do |k, v|
20
20
> ["{{ k }}"]="{{ v }}"
21
21
end
22
22
> )
23
23
end
24
24
when String, NilClass
25
- > {{ name }}="{{ value }}"
25
+ > declare -g {{ name }}="{{ value }}"
26
26
else
27
- > {{ name }}={{ value }}
27
+ > declare -g {{ name }}={{ value }}
28
28
end
Original file line number Diff line number Diff line change @@ -10,8 +10,16 @@ output_folder: output
10
10
download_sources:
11
11
- youtube
12
12
- instagram
13
+ environments:
14
+ - dev
15
+ - stage
16
+ - production
13
17
+ ./cli compress
14
18
build_number: 1337
15
19
zip_options:
16
20
compression_level: fast
17
21
pattern: *.json
22
+ environments:
23
+ - dev
24
+ - stage
25
+ - production
You can’t perform that action at this time.
0 commit comments