mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-08-14 02:28:03 -07:00
replaced underscore with dash in api syscalls
This commit is contained in:
parent
7ed705cee7
commit
b6b7eacadb
283 changed files with 438 additions and 412 deletions
61
bin/v-list-sys-config
Executable file
61
bin/v-list-sys-config
Executable 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
|
Loading…
Add table
Add a link
Reference in a new issue