37 lines
701 B
Bash
37 lines
701 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
ARG=$1
|
||
|
ACTIONS=(login register rcvpw username)
|
||
|
|
||
|
print_help(){
|
||
|
echo "usage: $0 [action]"
|
||
|
echo "available actions:"
|
||
|
for el in ${ACTIONS[@]}; do
|
||
|
echo - $el
|
||
|
done
|
||
|
exit 1
|
||
|
}
|
||
|
|
||
|
if [[ -z $1 ]]; then
|
||
|
print_help
|
||
|
fi
|
||
|
|
||
|
|
||
|
case $ARG in
|
||
|
"${ACTIONS[0]}")
|
||
|
echo "login action"
|
||
|
curl localhost:5050/api/login -X POST -d '{"username":"test","password":"test"}'
|
||
|
;;
|
||
|
"${ACTIONS[1]}")
|
||
|
echo "register action"
|
||
|
curl localhost:5050/api/register -X POST -d '{"username":"test","password":"test"}'
|
||
|
;;
|
||
|
"${ACTIONS[2]}")
|
||
|
echo "rcv_pw action"
|
||
|
;;
|
||
|
*)
|
||
|
echo "Action not available"
|
||
|
print_help
|
||
|
;;
|
||
|
esac
|