Script 'parse-games': modify the setup function.
This commit is contained in:
parent
e9bafd8838
commit
d57bc132ad
@ -8,17 +8,13 @@ REPO_DIR=
|
|||||||
TOURNAMENT=
|
TOURNAMENT=
|
||||||
|
|
||||||
function parse_setup {
|
function parse_setup {
|
||||||
[[ -z $REPO_DIR ]] && REPO_DIR=`dirname "$0"`
|
: ${REPO_DIR:=`dirname "$0"`}
|
||||||
# Convert REPO_DIR to an absolute path
|
|
||||||
[[ ! $REPO_DIR =~ ^/ ]] && REPO_DIR=$(cd ${REPO_DIR}; pwd)
|
|
||||||
|
|
||||||
# If no tournament given, set it to the last one
|
# If no tournament given, set it to the last one
|
||||||
if [[ -z $TOURNAMENT ]]; then
|
if [[ -z $TOURNAMENT ]]; then
|
||||||
local year_dir=$(ls -1 -d ${REPO_DIR}/[0-9][0-9][0-9][0-9]/ | tail -1)
|
local year_dir=$(ls -1 -d ${REPO_DIR}/[0-9][0-9][0-9][0-9]/ | tail -1)
|
||||||
TOURNAMENT=$(ls -1 -d ${year_dir}[0-9]-*/ | tail -1 \
|
TOURNAMENT=$(ls -1 -d ${year_dir}[0-9]-*/ | tail -1 \
|
||||||
| sed -E "s|${REPO_DIR}/(.*)|\1|")
|
| sed -E "s|${REPO_DIR}/(.*)/|\1|")
|
||||||
# Remove the trailing slash
|
|
||||||
TOURNAMENT=${TOURNAMENT%/}
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user