From d8b8b84942b514881bb2df6415f3246aeb12f710 Mon Sep 17 00:00:00 2001 From: Emmanuel Raviart Date: Mon, 6 Feb 2023 16:06:50 +0100 Subject: [PATCH] Increase verbosity of download script --- src/scripts/download_dila_dataset.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/scripts/download_dila_dataset.ts b/src/scripts/download_dila_dataset.ts index 882caa2..b953dad 100644 --- a/src/scripts/download_dila_dataset.ts +++ b/src/scripts/download_dila_dataset.ts @@ -8,7 +8,7 @@ import { $, cd } from "zx" async function downloadDataset( datasetName: string, dilaDir: string, - { push }: { push?: boolean } = {}, + { push, silent }: { push?: boolean; silent?: boolean } = {}, ): Promise { const datasetNameUpper = datasetName.toUpperCase() const archivesUrl = `https://echanges.dila.gouv.fr/OPENDATA/${datasetNameUpper}/` @@ -94,6 +94,9 @@ async function downloadDataset( if (latestArchiveDate != null && date <= latestArchiveDate) { continue } + if (!silent) { + console.log(`Adding ${archiveName} to dataset…`) + } const archiveUrl = new URL(archiveName, archivesUrl).toString() await $`curl --remote-name --show-error --silent ${archiveUrl}` if (archiveName.match(fullArchiveNameRegExp) === null) { @@ -162,8 +165,9 @@ async function downloadDataset( sade("download_dila_dataset ", true) .describe("Download latest versions of a Dila dataset") - .example("dole ../dila-data/s") + .example("dole ../dila-data/") .option("-p, --push", "Push dataset repository") + .option("-s, --silent", "Hide log messages") .action(async (dataset, dilaDir, options) => { await downloadDataset(dataset, dilaDir, options) process.exit(0)