Script 'schedule': fix regexps.
This commit is contained in:
parent
0d8249a7ae
commit
bdf3444c63
16
schedule
16
schedule
@ -8,7 +8,7 @@ TOURNAMENT="2014/1-tabiyas"
|
||||
# Version information
|
||||
VERSION="0.3"
|
||||
|
||||
argv0=${0##*/}
|
||||
argv0="${0##*/}"
|
||||
|
||||
usage() {
|
||||
cat <<EOF
|
||||
@ -125,7 +125,7 @@ get_tour_num() {
|
||||
}
|
||||
|
||||
get_tour_dates() {
|
||||
local date_re="[0-9?]{2}\\.[0-9?]{2}\\.[0-9?]{4}"
|
||||
local date_re="[0-9?]{2}\.[0-9?]{2}\.[0-9?]{4}"
|
||||
|
||||
if [[ "$1" =~ "Время проведения:"\ *($date_re)\ *[-—]\ *($date_re) ]]; then
|
||||
date_beg="${BASH_REMATCH[1]}" date_end="${BASH_REMATCH[2]}"
|
||||
@ -138,8 +138,8 @@ get_tour_dates() {
|
||||
}
|
||||
|
||||
keep_game_info() {
|
||||
local date_re="([0-9?]{2})\\.([0-9?]{2})\\.([0-9?]{4})"
|
||||
local res_re="(0|1|0\\.5):(0|1|0\\.5)"
|
||||
local date_re="([0-9?]{2})\.([0-9?]{2})\.([0-9?]{4})"
|
||||
local res_re="(0|1|0\.5):(0|1|0\.5)"
|
||||
local line="$1" keep=1
|
||||
|
||||
if [[ "$line" =~ ($date_re)\ *[-—]\ *([^\ ]+)\ *($res_re)?\ *([^\ ]+) ]]; then
|
||||
@ -187,12 +187,12 @@ info_output_term() {
|
||||
# PLAYER is a part of 'game_url' or 'result'
|
||||
[[ "$name" =~ ^http:// || "$name" =~ ^(1-0|0-1|1/2)$ ]] && continue
|
||||
|
||||
line=$(sed -E "s/(${name})/\\$(tput setaf 1)\1\\$(tput sgr0)/g" <<< "$line")
|
||||
line=$(sed -E "s/(${name})/$(tput setaf 1)\1$(tput sgr0)/g" <<< "$line")
|
||||
done
|
||||
fi
|
||||
|
||||
# Highlight result
|
||||
line=$(sed -E "s/ (1-0|0-1|1\\/2)( |$)/ \\$(tput setaf 6)\1\\$(tput sgr0)\2/g" <<< "$line")
|
||||
line=$(sed -E "s/ (1-0|0-1|1\/2)( |$)/ $(tput setaf 6)\1$(tput sgr0)\2/g" <<< "$line")
|
||||
|
||||
echo "$line"
|
||||
done
|
||||
@ -239,11 +239,11 @@ info_output_html() {
|
||||
|
||||
checkargs() {
|
||||
if [[ "$OPTARG" =~ ^-[apflhv]$ ]]; then
|
||||
echo "Option -${opt}: argument not found"
|
||||
echo "Option -${opt}: argument not found" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
if [[ "$opt" == f && ! "$OPTARG" =~ ^(term|html|lor)$ ]]; then
|
||||
echo "Incorrect FORMAT specified"
|
||||
echo "Incorrect FORMAT specified" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user