Script 'game-add': check for duplicate game ID.
This commit is contained in:
parent
8a596606e9
commit
038be5ab4c
7
game-add
7
game-add
@ -57,9 +57,10 @@ function game_check_args {
|
|||||||
[[ -z $TOUR || $# == 0 ]] && usage 1
|
[[ -z $TOUR || $# == 0 ]] && usage 1
|
||||||
# Don't add and clean up games simultaneously
|
# Don't add and clean up games simultaneously
|
||||||
$ADD_GAMES && $CLEANUP_GAMES && usage 1
|
$ADD_GAMES && $CLEANUP_GAMES && usage 1
|
||||||
# Check for duplicate URL
|
# Check for duplicate game ID
|
||||||
local url_uniq=$(xargs -n1 <<< $@ | sort -u | wc -l)
|
local uniq_ids=$(xargs -n1 <<< $@ | sed -E "s|^http://[^/]*/([^/]{8}).*|\1|" \
|
||||||
(( $# == $url_uniq )) || die "Game URLs not unique."
|
| sort -u | wc -l)
|
||||||
|
(( $# == $uniq_ids )) || die "Game IDs not unique."
|
||||||
}
|
}
|
||||||
|
|
||||||
function game_setup {
|
function game_setup {
|
||||||
|
Loading…
Reference in New Issue
Block a user