mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-08-20 05:14:08 -07:00
stronger parsing
This commit is contained in:
parent
e61ee85680
commit
b2a6871c39
2 changed files with 3 additions and 3 deletions
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
# Argument defenition
|
# Argument defenition
|
||||||
key=$(echo "$1" | tr '[:lower:]' '[:upper:]' )
|
key=$(echo "$1" | tr '[:lower:]' '[:upper:]' )
|
||||||
value=${2// /%spc%}
|
value=$2
|
||||||
|
|
||||||
# Importing variables
|
# Importing variables
|
||||||
source $VESTA/conf/vars.conf
|
source $VESTA/conf/vars.conf
|
||||||
|
|
|
@ -19,12 +19,12 @@ source $VESTA/conf/vars.conf
|
||||||
json_list_conf() {
|
json_list_conf() {
|
||||||
lines=$(wc -l $V_CONF/vesta.conf | cut -f 1 -d ' ')
|
lines=$(wc -l $V_CONF/vesta.conf | cut -f 1 -d ' ')
|
||||||
i='0'
|
i='0'
|
||||||
|
IFS=$'\n'
|
||||||
echo -e "{\n\t\"config\": {"
|
echo -e "{\n\t\"config\": {"
|
||||||
for str in $(cat $V_CONF/vesta.conf); do
|
for str in $(cat $V_CONF/vesta.conf); do
|
||||||
(( ++i))
|
(( ++i))
|
||||||
key=${str%%=*}
|
key=${str%%=*}
|
||||||
value=${str#*=}
|
value=${str#*=}
|
||||||
value=${value//%spc%/ }
|
|
||||||
if [ "$i" -lt "$lines" ]; then
|
if [ "$i" -lt "$lines" ]; then
|
||||||
echo -e "\t\t\"$key\": \"${value//\'/}\","
|
echo -e "\t\t\"$key\": \"${value//\'/}\","
|
||||||
else
|
else
|
||||||
|
@ -36,10 +36,10 @@ json_list_conf() {
|
||||||
|
|
||||||
# Shell function
|
# Shell function
|
||||||
shell_list_conf() {
|
shell_list_conf() {
|
||||||
|
IFS=$'\n'
|
||||||
for str in $(cat $V_CONF/vesta.conf); do
|
for str in $(cat $V_CONF/vesta.conf); do
|
||||||
key=${str%%=*}
|
key=${str%%=*}
|
||||||
value=${str#*=}
|
value=${str#*=}
|
||||||
value=${value//%spc%/ }
|
|
||||||
echo "$key: ${value//\'/}"
|
echo "$key: ${value//\'/}"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue