57 lines
964 B
Bash
Executable File
57 lines
964 B
Bash
Executable File
#!/bin/bash
|
|
# SPDX-FileCopyrightText: 2025 artlog@l0g.eu
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
#
|
|
|
|
toolsdir=../lib
|
|
pushd $toolsdir >/dev/null
|
|
toolsdir=$(pwd)
|
|
source metascript.sh
|
|
popd >/dev/null
|
|
|
|
while [[ $# > 0 ]]
|
|
do
|
|
case "$1" in
|
|
*.json)
|
|
json_file=$1
|
|
;;
|
|
*)
|
|
if [[ $1 =~ [0-9]+ ]]
|
|
then
|
|
vote=$1
|
|
else
|
|
parsemetaarg "$1"
|
|
fi
|
|
;;
|
|
esac
|
|
shift
|
|
done
|
|
|
|
if [[ -z $vote ]] && [[ -z $json_file ]]
|
|
then
|
|
log_error "numéro de vote manquant ( ex 1 pour 1.json )"
|
|
exit 1
|
|
fi
|
|
|
|
if [[ -z $json_file ]]
|
|
then
|
|
json_file=$vote.json
|
|
fi
|
|
|
|
enforcefile $json_file exists
|
|
|
|
json=json
|
|
if [[ -x $json ]]
|
|
then
|
|
json_indent_file=$vote.indent.json
|
|
echo "generating $json_indent_file"
|
|
$json indent=spaces:2 -- $json_file > $json_indent_file
|
|
json_file=$json_indent_file
|
|
enforcefile $json_file exists
|
|
fi
|
|
|
|
code_dir=../code/
|
|
|
|
python3 ${code_dir}parse_sample.py $json_file
|
|
php ${code_dir}parse_sample.php $json_file
|