mirror of
https://github.com/serghey-rodin/vesta.git
synced 2024-12-11 06:40:47 -08:00
81 lines
1.6 KiB
Bash
Executable File
81 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
# info: list system users
|
|
# options: [FORMAT]
|
|
#
|
|
# The function for obtaining the list of system users without
|
|
# detailed information.
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Variable&Function #
|
|
#----------------------------------------------------------#
|
|
|
|
# Argument definition
|
|
format=${1-shell}
|
|
|
|
# Includes
|
|
source $VESTA/func/main.sh
|
|
|
|
# JSON list function
|
|
json_list() {
|
|
objects=$(echo "$languages" |wc -l)
|
|
i=1
|
|
echo '['
|
|
for lang in $languages; do
|
|
if [ "$i" -lt "$objects" ]; then
|
|
echo -e "\t\"$lang\","
|
|
else
|
|
echo -e "\t\"$lang\""
|
|
fi
|
|
(( ++i))
|
|
done
|
|
echo "]"
|
|
}
|
|
|
|
# SHELL list function
|
|
shell_list() {
|
|
echo "LANGUAGE"
|
|
echo "--------"
|
|
for lang in $languages; do
|
|
echo "$lang"
|
|
done
|
|
}
|
|
|
|
# PLAIN list function
|
|
plain_list() {
|
|
for lang in $languages; do
|
|
echo "$lang"
|
|
done
|
|
}
|
|
|
|
# CSV list function
|
|
csv_list() {
|
|
echo "LANGUAGE"
|
|
for lang in $languages; do
|
|
echo "$lang"
|
|
done
|
|
}
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Action #
|
|
#----------------------------------------------------------#
|
|
|
|
# Defining language list
|
|
languages=$(ls $VESTA/web/inc/i18n/ |cut -f 1 -d .)
|
|
|
|
# Listing data
|
|
case $format in
|
|
json) json_list ;;
|
|
plain) plain_list ;;
|
|
csv) csv_list ;;
|
|
shell) shell_list;;
|
|
esac
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
# Vesta #
|
|
#----------------------------------------------------------#
|
|
|
|
exit
|