pass team code as flag

This commit is contained in:
filifa 2024-07-25 22:27:25 -05:00
parent 6f25185b92
commit 5980c56e71
3 changed files with 47 additions and 5 deletions

View File

@ -1,7 +1,19 @@
#!/bin/bash
gamePk=$(./livepk.sh)
if [[ "$gamePk" = 'null' ]]
while getopts 't:' opt
do
case $opt in
t)
team=$OPTARG
;;
?)
exit 1
;;
esac
done
gamePk=$(./livepk.sh -t $team)
if [[ -z $gamePk || "$gamePk" = 'null' ]]
then
exit 1
fi

View File

@ -1,4 +1,22 @@
#!/bin/bash
while getopts 't:' opt
do
case $opt in
t)
team=$OPTARG
;;
?)
exit 1
;;
esac
done
if [[ -z $team ]]
then
echo "$0:" '-t is required' >&2
exit 1
fi
# grab most recently started live pk, if multiple
echo $(mlblive schedule -t $TEAM | jq '.dates[].games | map(select(.status.abstractGameState == "Live"))[-1].gamePk')
echo $(mlblive schedule -t $team | jq '.dates[].games | map(select(.status.abstractGameState == "Live"))[-1].gamePk')

View File

@ -1,7 +1,19 @@
#!/bin/bash
gamePk=$(./livepk.sh)
if [[ "$gamePk" = 'null' ]]
while getopts 't:' opt
do
case $opt in
t)
team=$OPTARG
;;
?)
exit 1
;;
esac
done
gamePk=$(./livepk.sh -t $team)
if [[ -z $gamePk || "$gamePk" = 'null' ]]
then
exit 1
fi