replaced underscore with dash in api syscalls

This commit is contained in:
Serghey Rodin 2012-11-09 18:26:32 +02:00
commit b6b7eacadb
283 changed files with 438 additions and 412 deletions

61
bin/v-list-sys-config Executable file
View file

@ -0,0 +1,61 @@
#!/bin/bash
# info: list system config
# options: [format]
#
# The function for obtaining the list of system parameters.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument defenition
format=${1-shell}
# Json function
json_list_conf() {
lines=$(wc -l $VESTA/conf/vesta.conf | cut -f 1 -d ' ')
i='0'
IFS=$'\n'
echo -e "{\n\t\"config\": {"
for str in $(cat $VESTA/conf/vesta.conf); do
(( ++i))
key=${str%%=*}
value=${str#*=}
if [ "$i" -lt "$lines" ]; then
echo -e "\t\t\"$key\": \"${value//\'/}\","
else
echo -e "\t\t\"$key\": \"${value//\'/}\""
fi
done
echo -e "\t}\n}"
}
# Shell function
shell_list_conf() {
IFS=$'\n'
for str in $(cat $VESTA/conf/vesta.conf); do
key=${str%%=*}
value=${str#*=}
echo "$key: ${value//\'/}"
done
}
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Listing system config
case $format in
json) json_list_conf ;;
plain) shell_list_conf ;;
shell) shell_list_conf | column -t ;;
esac
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
exit