mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-08-14 10:37:39 -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
|
||||
key=$(echo "$1" | tr '[:lower:]' '[:upper:]' )
|
||||
value=${2// /%spc%}
|
||||
value=$2
|
||||
|
||||
# Importing variables
|
||||
source $VESTA/conf/vars.conf
|
||||
|
|
|
@ -19,12 +19,12 @@ source $VESTA/conf/vars.conf
|
|||
json_list_conf() {
|
||||
lines=$(wc -l $V_CONF/vesta.conf | cut -f 1 -d ' ')
|
||||
i='0'
|
||||
IFS=$'\n'
|
||||
echo -e "{\n\t\"config\": {"
|
||||
for str in $(cat $V_CONF/vesta.conf); do
|
||||
(( ++i))
|
||||
key=${str%%=*}
|
||||
value=${str#*=}
|
||||
value=${value//%spc%/ }
|
||||
if [ "$i" -lt "$lines" ]; then
|
||||
echo -e "\t\t\"$key\": \"${value//\'/}\","
|
||||
else
|
||||
|
@ -36,10 +36,10 @@ json_list_conf() {
|
|||
|
||||
# Shell function
|
||||
shell_list_conf() {
|
||||
IFS=$'\n'
|
||||
for str in $(cat $V_CONF/vesta.conf); do
|
||||
key=${str%%=*}
|
||||
value=${str#*=}
|
||||
value=${value//%spc%/ }
|
||||
echo "$key: ${value//\'/}"
|
||||
done
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue