mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-04-20 23:23:56 +03:00
tools/endpoint-hci-version: mri -> util.parseArgs
This commit is contained in:
parent
f45842d7a3
commit
1e3cbc09a1
2 changed files with 23 additions and 11 deletions
|
@ -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 <profile>
|
||||
|
@ -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,
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
},
|
||||
"author": "Jannis R <mail@jannisr.de>",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"mri": "^1.1.4"
|
||||
"engines": {
|
||||
"node": ">=16.17"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue