#!/usr/bin/env bash
#
##
  if [ "$#" == "0" ]
  then
    echo "usage: $(basename $0) <cookie>"
    echo "copy the cookie from the browser dev console"
    exit 1
  else
    cookie="$1"
    curl 'https://dragons.dev/analysis' \
      -d "owner=github&repo=training-kit" \
      -X POST \
      -H 'Content-Type: application/x-www-form-urlencoded' \
      -H "Cookie: JWT-Cookie=$cookie" \
      --silent \
      --compressed
    if [[ $? -eq 0 ]]; then
      echo done
      exit 0
    else
      echo error
      exit 1
    fi
  fi
##