From 1e3cbc09a1fddb1cab97fab34f9f8bc50145eb99 Mon Sep 17 00:00:00 2001 From: Jannis R Date: Tue, 25 Apr 2023 00:38:41 +0200 Subject: [PATCH] tools/endpoint-hci-version: mri -> util.parseArgs --- tools/endpoint-hci-version/cli.js | 30 +++++++++++++++++-------- tools/endpoint-hci-version/package.json | 4 ++-- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/tools/endpoint-hci-version/cli.js b/tools/endpoint-hci-version/cli.js index b96626bf..665dac5f 100755 --- a/tools/endpoint-hci-version/cli.js +++ b/tools/endpoint-hci-version/cli.js @@ -1,16 +1,27 @@ #!/usr/bin/env node -import mri from 'mri' +import {parseArgs} from 'node:util' import {createClient} from '../../index.js' -const argv = mri(process.argv.slice(2), { - boolean: [ - 'help', 'h', - 'silent', 's', - ] +const { + values: flags, + positionals: args, +} = parseArgs({ + options: { + help: { + type: 'boolean', + short: 'h', + }, + silent: { + type: 'boolean', + short: 's', + }, + }, + strict: true, + allowPositionals: true, }) -if (argv.help || argv.h) { +if (flags.help) { process.stdout.write(` Usage: endpoint-hci-version @@ -23,10 +34,11 @@ Examples: process.exit(0) } -const silent = argv.silent || argv.s +const profileName = args[0] +const silent = flags.silent ;(async () => { - const {profile} = await import(`../../p/${argv._[0]}/index.js`) + const {profile} = await import(`../../p/${profileName}/index.js`) const client = createClient( profile, diff --git a/tools/endpoint-hci-version/package.json b/tools/endpoint-hci-version/package.json index a0c8494c..9b192941 100644 --- a/tools/endpoint-hci-version/package.json +++ b/tools/endpoint-hci-version/package.json @@ -8,7 +8,7 @@ }, "author": "Jannis R ", "license": "ISC", - "dependencies": { - "mri": "^1.1.4" + "engines": { + "node": ">=16.17" } }