mirror of
https://github.com/myvesta/vesta
synced 2025-07-16 10:03:23 -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
67
bin/v-list-web-templates-nginx
Executable file
67
bin/v-list-web-templates-nginx
Executable file
|
@ -0,0 +1,67 @@
|
|||
#!/bin/bash
|
||||
# info: listing nginx templates
|
||||
# options: [format]
|
||||
#
|
||||
# The function for obtaining the list of nginx templates available to a user.
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Variable&Function #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Argument defenition
|
||||
format=${1-shell}
|
||||
|
||||
# Includes
|
||||
source $VESTA/func/main.sh
|
||||
|
||||
# Json function
|
||||
json_list_wtpl() {
|
||||
templates=$(ls -t $WEBTPL |grep 'nginx' |grep '\.tpl' |cut -f 2 -d '_'\
|
||||
|cut -f 1 -d '.')
|
||||
t_counter=$(echo "$templates" | wc -w)
|
||||
i=1
|
||||
echo '['
|
||||
for template in $templates; do
|
||||
if [ "$i" -lt "$t_counter" ]; then
|
||||
echo -e "\t\"$template\","
|
||||
else
|
||||
echo -e "\t\"$template\""
|
||||
fi
|
||||
(( ++i))
|
||||
done
|
||||
echo "]"
|
||||
}
|
||||
|
||||
# Shell function
|
||||
shell_list_wtpl() {
|
||||
templates=$(ls -t $WEBTPL |grep 'nginx' |grep '\.tpl' |cut -f 2 -d '_'\
|
||||
|cut -f 1 -d '.')
|
||||
if [ -z "$nohead" ]; then
|
||||
echo "Templates"
|
||||
echo "----------"
|
||||
fi
|
||||
for template in $templates; do
|
||||
echo "$template"
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Action #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Listing domains
|
||||
case $format in
|
||||
json) json_list_wtpl ;;
|
||||
plain) nohead=1; shell_list_wtpl ;;
|
||||
shell) shell_list_wtpl ;;
|
||||
*) check_args '1' '0' '[format]'
|
||||
esac
|
||||
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Vesta #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
exit
|
Loading…
Add table
Add a link
Reference in a new issue