From 7649c7078c6ca0d641bec0a2e1c790994b6e84db Mon Sep 17 00:00:00 2001 From: freearhey Date: Sun, 17 Jan 2021 18:00:52 +0300 Subject: [PATCH] Install commander package --- package-lock.json | 6 ++++++ package.json | 1 + scripts/format.js | 17 +++++++++++------ 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2a1cdedeb..143008432 100644 --- a/package-lock.json +++ b/package-lock.json @@ -32,6 +32,12 @@ "integrity": "sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w==", "dev": true }, + "commander": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-7.0.0.tgz", + "integrity": "sha512-ovx/7NkTrnPuIV8sqk/GjUIIM1+iUQeqA3ye2VNpq9sVoiZsooObWlQy+OPWGI17GDaEoybuAGJm6U8yC077BA==", + "dev": true + }, "epg-parser": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/epg-parser/-/epg-parser-0.1.2.tgz", diff --git a/package.json b/package.json index 7b56ece90..f4cc93274 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "dependencies": {}, "devDependencies": { "axios": "^0.21.1", + "commander": "^7.0.0", "epg-parser": "^0.1.2", "escape-string-regexp": "^2.0.0", "iptv-checker-module": "^2.0.2", diff --git a/scripts/format.js b/scripts/format.js index a123c68bb..6d9c2646a 100644 --- a/scripts/format.js +++ b/scripts/format.js @@ -1,11 +1,16 @@ +const { program } = require('commander') const helper = require('./helper') -const config = { - debug: process.env.npm_config_debug || false, - country: process.env.npm_config_country, - exclude: process.env.npm_config_exclude, - epg: process.env.npm_config_epg || false -} +program + .version('1.0.0', '-v, --version') + .usage('[OPTIONS]...') + .option('-d, --debug', 'Debug mode') + .option('-c, --country ', 'Comma-separated list of country codes') + .option('-e, --exclude ', 'Comma-separated list of country codes to be excluded ') + .option('--epg', 'Turn on EPG parser') + .parse(process.argv) + +const config = program.opts() let updated = 0 let items = []