__ini_value: new parameter --quote
This parameter ensures the value is surrounded by double quotes. As it directly edits the value variable, the quoting will be added/removed automaticly.
This commit is contained in:
parent
19c701e95d
commit
0d4868dcd5
4 changed files with 16 additions and 1 deletions
|
@ -57,6 +57,11 @@ BEGIN {
|
||||||
comment_signs[i++] = tmp
|
comment_signs[i++] = tmp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(system("test -f " (_param "quote")) == 0) {
|
||||||
|
# quote it now that it only wins checks against quoted values
|
||||||
|
value = ("\"" value "\"")
|
||||||
|
}
|
||||||
|
|
||||||
found=0
|
found=0
|
||||||
curr_section=""
|
curr_section=""
|
||||||
if(section == "")
|
if(section == "")
|
||||||
|
|
|
@ -11,6 +11,11 @@ BEGIN {
|
||||||
get_param_array("comment-sign", comment_signs)
|
get_param_array("comment-sign", comment_signs)
|
||||||
comment_sign = comment_signs[0]
|
comment_sign = comment_signs[0]
|
||||||
|
|
||||||
|
if(system("test -f " (_param "quote")) == 0) {
|
||||||
|
# quote it now that it only wins checks against quoted values
|
||||||
|
value = ("\"" value "\"")
|
||||||
|
}
|
||||||
|
|
||||||
base_spaces = spaces(indentation)
|
base_spaces = spaces(indentation)
|
||||||
delimiter_spaces = spaces(delimiter_space)
|
delimiter_spaces = spaces(delimiter_space)
|
||||||
delimiter_w_spaces = (delimiter_spaces delimiter delimiter_spaces)
|
delimiter_w_spaces = (delimiter_spaces delimiter delimiter_spaces)
|
||||||
|
@ -59,5 +64,5 @@ function v_print_commented() {
|
||||||
}
|
}
|
||||||
# print comment
|
# print comment
|
||||||
function c_print() {
|
function c_print() {
|
||||||
printf "%s%s%s%s%s", base_spaces, comment_sign, " ", comment, ORS
|
printf "%s%s %s%s", base_spaces, comment_sign, comment, ORS
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,6 +79,10 @@ normalize
|
||||||
configuration file. Even if a key-value pair is correct as-is, it will
|
configuration file. Even if a key-value pair is correct as-is, it will
|
||||||
correct the line to be pretty and perfect.
|
correct the line to be pretty and perfect.
|
||||||
|
|
||||||
|
quote
|
||||||
|
Wrap double quotes (``"``) around the value. If the value is previously
|
||||||
|
unquoted, the file will be modified to quote the value.
|
||||||
|
|
||||||
|
|
||||||
MESSAGES
|
MESSAGES
|
||||||
--------
|
--------
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
normalize
|
normalize
|
||||||
|
quote
|
||||||
|
|
Loading…
Reference in a new issue