...
|
...
|
@@ -87,11 +87,11 @@ BEGIN {
|
87
|
87
|
#help:BEGIN
|
88
|
88
|
case /^--conf=["']?.+["']?$/:
|
89
|
89
|
#help:file containing the configuration to read
|
90
|
|
- filename = gensub(/^--conf=["']?(.+)["']?$/, "\\1", "", ARGV[arg])
|
|
90
|
+ filename = gensub(/^--conf=["']?(.+)["']?$/, "\\1", "1", ARGV[arg])
|
91
|
91
|
break
|
92
|
92
|
case /^--conf$/:
|
93
|
93
|
#help:file containing the configuration to read
|
94
|
|
- filename = gensub(/^["']?(.+)["']?$/, "\\1", "", ARGV[++arg])
|
|
94
|
+ filename = gensub(/^["']?(.+)["']?$/, "\\1", "1", ARGV[++arg])
|
95
|
95
|
break
|
96
|
96
|
case "--sections-list":
|
97
|
97
|
#help:list all sections found in given config file
|
...
|
...
|
@@ -99,12 +99,12 @@ BEGIN {
|
99
|
99
|
break
|
100
|
100
|
case /^--section=["']?.+["']?$/:
|
101
|
101
|
#help:retrieve information for section <section>
|
102
|
|
- s = gensub(/^--section=["']?(.+)["']?$/, "\\1", "", ARGV[arg])
|
|
102
|
+ s = gensub(/^--section=["']?(.+)["']?$/, "\\1", "1", ARGV[arg])
|
103
|
103
|
onlysections[s] = true
|
104
|
104
|
break
|
105
|
105
|
# case /^-s$/:
|
106
|
106
|
##help:retrieve information for section <section>
|
107
|
|
-# s = gensub(/^["']?(.+)["']?$/, "\\1", "", ARGV[++arg])
|
|
107
|
+# s = gensub(/^["']?(.+)["']?$/, "\\1", "1", ARGV[++arg])
|
108
|
108
|
# onlysections[s] = true
|
109
|
109
|
# break
|
110
|
110
|
case /^--clean$/:
|
...
|
...
|
@@ -121,21 +121,21 @@ BEGIN {
|
121
|
121
|
break
|
122
|
122
|
case /^--array=["']?.+["']?$/:
|
123
|
123
|
#help:learns the script this entry is intented to be treated as an array, can be used multiple times for multiples array names
|
124
|
|
- arrayname=gensub(/^--array=["']?(.+)["']?$/, "\\1", "", ARGV[arg])
|
|
124
|
+ arrayname=gensub(/^--array=["']?(.+)["']?$/, "\\1", "1", ARGV[arg])
|
125
|
125
|
conf_arrays = conf_arrays "|" arrayname
|
126
|
126
|
key_array[arrayname]++
|
127
|
127
|
break
|
128
|
128
|
case /^--first-element-array=[01]$/:
|
129
|
129
|
#help:tells the script the array index begins at 0 or 1, defaults to 0
|
130
|
|
- first_element_index = gensub(/^--first-element-array=([01])$/, "\\1", "", ARGV[arg])
|
|
130
|
+ first_element_index = gensub(/^--first-element-array=([01])$/, "\\1", "1", ARGV[arg])
|
131
|
131
|
break
|
132
|
132
|
case /^--var-delim-begin=["']?.{3,}["']?$/:
|
133
|
133
|
#help:tells the script what is the starting chars sequence to delimitate a variable, defaults to {{{, can be -+= (for example)
|
134
|
|
- var_delimiters_begin = gensub(/^--var-delim-begin=["']?(.{3,})["']?$/, "\\1", "", ARGV[arg])
|
|
134
|
+ var_delimiters_begin = gensub(/^--var-delim-begin=["']?(.{3,})["']?$/, "\\1", "1", ARGV[arg])
|
135
|
135
|
break
|
136
|
136
|
case /^--var-delim-end=["']?.{3,}["']?$/:
|
137
|
137
|
#help:tells the script what is the ending chars sequence to delimitate a variable, defaults to }}}, can be =+- (for example)
|
138
|
|
- var_delimiters_end = gensub(/^--var-delim-end=["']?(.{3,})["']?$/, "\\1", "", ARGV[arg])
|
|
138
|
+ var_delimiters_end = gensub(/^--var-delim-end=["']?(.{3,})["']?$/, "\\1", "1", ARGV[arg])
|
139
|
139
|
break
|
140
|
140
|
case /^--case-sensitive$/:
|
141
|
141
|
#help:tells the script if it has to be case-sensitive, defaults to insensitive
|
...
|
...
|
@@ -146,17 +146,17 @@ BEGIN {
|
146
|
146
|
#help: lower = variables output in lowercase (default)
|
147
|
147
|
#help: UPPER = variables output in UPPERCASE
|
148
|
148
|
case_sensitive = false
|
149
|
|
- default_case = gensub(/^--case-insensitive[=]?(.*)$/, "\\1", "", ARGV[arg])
|
|
149
|
+ default_case = gensub(/^--case-insensitive[=]?(.*)$/, "\\1", "1", ARGV[arg])
|
150
|
150
|
if (default_case == "")
|
151
|
151
|
default_case = "lower"
|
152
|
152
|
break
|
153
|
153
|
case /^--key-value-delimiter=["']?.["']?$/:
|
154
|
154
|
#help:tells the script which char is used to separate the key from its assorciated value in the configuration file, defaults to blank-char
|
155
|
|
- key_value_delimiter = gensub(/^--key-value-delimiter=["']?(.)["']?$/, "\\1", "", ARGV[arg])
|
|
155
|
+ key_value_delimiter = gensub(/^--key-value-delimiter=["']?(.)["']?$/, "\\1", "1", ARGV[arg])
|
156
|
156
|
break
|
157
|
157
|
case /^--in-var-space-replacement=["']?.["']?$/:
|
158
|
158
|
#help:tells the script which char to use to replace a space found in a key, defaults to empty
|
159
|
|
- in_var_space_remplacement = gensub(/^--in-var-space-replacement=["']?(.)["']?$/, "\\1", "", ARGV[arg])
|
|
159
|
+ in_var_space_remplacement = gensub(/^--in-var-space-replacement=["']?(.)["']?$/, "\\1", "1", ARGV[arg])
|
160
|
160
|
break
|
161
|
161
|
case /^help$/:
|
162
|
162
|
#help:show this help
|
...
|
...
|
@@ -175,7 +175,7 @@ BEGIN {
|
175
|
175
|
close(filename)
|
176
|
176
|
|
177
|
177
|
if (conf_arrays != "") {
|
178
|
|
- conf_arrays = gensub("^|", "", "", conf_arrays)
|
|
178
|
+ conf_arrays = gensub("^|", "", "1", conf_arrays)
|
179
|
179
|
if (key_value_delimiter != "")
|
180
|
180
|
conf_arrays = gensub(/\s/, in_var_space_remplacement, "g", conf_arrays)
|
181
|
181
|
conf_arrays = apply_case_sensivity(conf_arrays)
|
...
|
...
|
@@ -205,7 +205,7 @@ BEGIN {
|
205
|
205
|
}
|
206
|
206
|
else {
|
207
|
207
|
key = $1
|
208
|
|
- value = clean ? "" : gensub("^[[:blank:]]*" $1 "[[:blank:]]*", "", "")
|
|
208
|
+ value = clean ? "" : gensub("^[[:blank:]]*" $1 "[[:blank:]]*", "", "1")
|
209
|
209
|
}
|
210
|
210
|
key = apply_case_sensivity(key)
|
211
|
211
|
if (key ~ "^(" conf_arrays ")$" && ! unset)
|