Skip to content

Commit 5f5ca2d

Browse files
committed
Update script for closed places
1 parent 6b1f62f commit 5f5ca2d

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

scripts/check-google-maps.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,19 @@ import fs from 'fs';
33
import path from 'path';
44
import { load } from '../data.js';
55

6-
const city = process.argv[2];
6+
const args = process.argv.slice(2);
7+
const include = args.filter(a => !a.startsWith('-'));
8+
const exclude = args.filter(a => a.startsWith('-')).map(a => a.slice(1));
79
const { places } = load();
8-
const toCheck = places.filter(p => p.google_maps && !p.closed && (!city || p.city === city));
10+
const toCheck = places.filter(p => {
11+
if (!p.google_maps || p.closed) return false;
12+
if (exclude.includes(p.city)) return false;
13+
if (include.length > 0) return include.includes(p.city);
14+
return true;
15+
});
916

10-
console.log(`Found ${toCheck.length} non-closed cafes to check${city ? ` in ${city}` : ''}.\n`);
17+
const label = include.length ? ` in ${include.join(', ')}` : exclude.length ? ` excluding ${exclude.join(', ')}` : '';
18+
console.log(`Found ${toCheck.length} non-closed cafes to check${label}.\n`);
1119

1220
async function checkPlace(browser, url) {
1321
const page = await browser.newPage();

0 commit comments

Comments
 (0)