Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit c12f682

Browse files
committed
quick scraper debug args parsing change
1 parent 7663377 commit c12f682

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

awardwiz-scrapers/main-debug.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@ const options: DebugOptions = {
1919
browserDebug: true
2020
}
2121

22-
if (process.argv.length < 6)
23-
throw new Error("Not enough arguments. Example: <executable> delta SFO LAX 2023-05-01")
22+
const [scraperName, origin, destination, departureDate] = process.argv.slice(-4)
23+
if (!scraperName || !origin || !destination || !departureDate)
24+
throw new Error("Incorrect usage. Example: <executable> delta SFO LAX 2023-05-01")
2425

25-
const scraper = await import(`./scrapers/${process.argv[2]!}.js`) as AwardWizScraperModule
26-
const query: AwardWizQuery = { origin: process.argv[3]!, destination: process.argv[4]!, departureDate: process.argv[5]! }
26+
const scraper = await import(`./scrapers/${scraperName}.js`) as AwardWizScraperModule
27+
const query: AwardWizQuery = { origin, destination, departureDate }
2728

2829
const result = await runArkalis(async (arkalis) => {
2930
arkalis.log("Using query:", query)

0 commit comments

Comments
 (0)