un petit script pour transformer les fakes datas du format JSON au format liste C# (⚠️ tester que partiellement car erreur innatendue)
continuous-integration/drone/push Build is passing Details

API
Damien NORTIER 1 year ago
parent a9f36c9fc1
commit d524798969

@ -0,0 +1,32 @@
#!/bin/bash
for i in seq 0 $# ; do
echo "argument $i = $*[i]"
exit
done
if test "$1" = "--help" && test "$2" = "" ; then
cat << EOF
param 1 : name of the fake datas json file to convert
param 2 : name of class this is for
param 3 : name of the repertorie with all C# fake datas files
EOF
exit 0
fi
if test "$1" = "" || test "$2" = "" || test "$3" = "" ; then
echo "error : param require" >2
exit 1
fi
count=$( echo $1 | tr "." "\n" | wc -l )
name=$( echo $1 | cut -d ' ' -f -$(( $count - 1 )) )
target=$( echo "$3/$1" | sed "s/json$/cs/" )
echo "name : $name"
echo "target : $target"
cat fake-Answers.json | sed 's/:/ =/g' \
| sed 's/{/new AnswerEntity{/g' | sed 's/]/} ;/g' \
| sed 's/\[/IEnumerable<AnswerEntity> fakeAnswers = new List<AnswerEntity>\{/g' \
| sed "s/ \"/ /g" | sed 's/" =/ =/g'
Loading…
Cancel
Save