diff --git a/bin/dbus-dissect.js b/bin/dbus-dissect.js index b9cfbfb..96ed457 100644 --- a/bin/dbus-dissect.js +++ b/bin/dbus-dissect.js @@ -4,14 +4,15 @@ const net = require('net'); const abs = require('abstract-socket'); const through2 = require('through2'); -const optimist = require('optimist'); +const minimist = require('minimist'); const message = require('../lib/message'); const readLine = require('../lib/readline'); var sessionBusAddress = process.env.DBUS_SESSION_BUS_ADDRESS; var m = sessionBusAddress.match(/abstract=([^,]+)/); -var isSystemBus = optimist.boolean(['system']).argv.system; +var isSystemBus = minimist(process.argv.slice(2), { boolean: 'system' }).system; +console.log(isSystemBus); var address = isSystemBus ? '/var/run/dbus/system_bus_socket' : `\0${m[1]}`; diff --git a/bin/dbus2js.js b/bin/dbus2js.js index 72cf6fb..159face 100644 --- a/bin/dbus2js.js +++ b/bin/dbus2js.js @@ -6,9 +6,12 @@ const xml2js_opts = Object.assign({}, xml2js.defaults['0.1'], { explicitArray: true }); const dbus = require('../index'); -const optimist = require('optimist'); +const minimist = require('minimist'); -var argv = optimist.boolean(['server', 'dump']).argv; +var argv = minimist(process.argv.slice(2), { + boolean: ['server', 'dump', 'xml'], + string: ['bus', 'service', 'path'] +}); function die(err) { console.log(err); diff --git a/package-lock.json b/package-lock.json index f61560c..8f11232 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,10 +10,10 @@ "license": "MIT", "dependencies": { "@homebridge/long": "^5.2.1", - "@homebridge/put": "0.0.7", + "@homebridge/put": "~0.0.8", "event-stream": "^4.0.0", "hexy": "^0.2.10", - "optimist": "^0.6.1", + "minimist": "^1.2.6", "safe-buffer": "^5.1.1", "xml2js": "^0.4.17" }, @@ -21,6 +21,7 @@ "dbus2js": "bin/dbus2js.js" }, "devDependencies": { + "@types/minimist": "^1.2.2", "eslint": "^6.0.0", "eslint-config-prettier": "^3.0.0", "eslint-plugin-markdown": "^3.0.0", @@ -451,9 +452,9 @@ "integrity": "sha512-i5Df8R63XNPCn+Nj1OgAoRdw9e+jHUQb3CNUbvJneI2iu3j4+OtzQj+5PA1Ce+747NR1SPqZSvyvD483dOT3AA==" }, "node_modules/@homebridge/put": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/@homebridge/put/-/put-0.0.7.tgz", - "integrity": "sha512-W6Ow4i+8qyVOSwWUbkB01lNoONyPUB+sul+bqzCKE0S+1Y1/mKyYkHsQOm0IPyTP5Sj6mLYJyB6EAqJiWEtkMQ==", + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/@homebridge/put/-/put-0.0.8.tgz", + "integrity": "sha512-mwxLHHqKebOmOSU0tsPEWQSBHGApPhuaqtNpCe7U+AMdsduweANiu64E9SXXUtdpyTjsOpgSMLhD1+kbLHD2gA==", "engines": { "node": ">=0.3.0" } @@ -625,6 +626,12 @@ "@types/unist": "*" } }, + "node_modules/@types/minimist": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.2.tgz", + "integrity": "sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==", + "dev": true + }, "node_modules/@types/unist": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.6.tgz", @@ -3344,9 +3351,9 @@ } }, "node_modules/minimist": { - "version": "0.0.10", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", - "integrity": "sha512-iotkTvxc+TwOm5Ieim8VnSNvCDjCK9S8G3scJ50ZthspSxa7jx50jkhYduuAtAjvfDUwSgOwf8+If99AlOEhyw==" + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==" }, "node_modules/mkdirp": { "version": "0.5.5", @@ -3360,12 +3367,6 @@ "mkdirp": "bin/cmd.js" } }, - "node_modules/mkdirp/node_modules/minimist": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", - "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", - "dev": true - }, "node_modules/mocha": { "version": "10.0.0", "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.0.0.tgz", @@ -3885,15 +3886,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/optimist": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", - "integrity": "sha512-snN4O4TkigujZphWLN0E//nQmm7790RYaE53DdL7ZYwee2D8DDo9/EyYiKUfN3rneWUjhJnueija3G9I2i0h3g==", - "dependencies": { - "minimist": "~0.0.1", - "wordwrap": "~0.0.2" - } - }, "node_modules/optionator": { "version": "0.8.3", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", @@ -5025,14 +5017,6 @@ "node": ">=0.10.0" } }, - "node_modules/wordwrap": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", - "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=", - "engines": { - "node": ">=0.4.0" - } - }, "node_modules/workerpool": { "version": "6.2.1", "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz", @@ -5558,9 +5542,9 @@ "integrity": "sha512-i5Df8R63XNPCn+Nj1OgAoRdw9e+jHUQb3CNUbvJneI2iu3j4+OtzQj+5PA1Ce+747NR1SPqZSvyvD483dOT3AA==" }, "@homebridge/put": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/@homebridge/put/-/put-0.0.7.tgz", - "integrity": "sha512-W6Ow4i+8qyVOSwWUbkB01lNoONyPUB+sul+bqzCKE0S+1Y1/mKyYkHsQOm0IPyTP5Sj6mLYJyB6EAqJiWEtkMQ==" + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/@homebridge/put/-/put-0.0.8.tgz", + "integrity": "sha512-mwxLHHqKebOmOSU0tsPEWQSBHGApPhuaqtNpCe7U+AMdsduweANiu64E9SXXUtdpyTjsOpgSMLhD1+kbLHD2gA==" }, "@istanbuljs/load-nyc-config": { "version": "1.1.0", @@ -5695,6 +5679,12 @@ "@types/unist": "*" } }, + "@types/minimist": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.2.tgz", + "integrity": "sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==", + "dev": true + }, "@types/unist": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.6.tgz", @@ -7698,9 +7688,9 @@ } }, "minimist": { - "version": "0.0.10", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", - "integrity": "sha512-iotkTvxc+TwOm5Ieim8VnSNvCDjCK9S8G3scJ50ZthspSxa7jx50jkhYduuAtAjvfDUwSgOwf8+If99AlOEhyw==" + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==" }, "mkdirp": { "version": "0.5.5", @@ -7709,14 +7699,6 @@ "dev": true, "requires": { "minimist": "^1.2.5" - }, - "dependencies": { - "minimist": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", - "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", - "dev": true - } } }, "mocha": { @@ -8114,15 +8096,6 @@ "mimic-fn": "^2.1.0" } }, - "optimist": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", - "integrity": "sha512-snN4O4TkigujZphWLN0E//nQmm7790RYaE53DdL7ZYwee2D8DDo9/EyYiKUfN3rneWUjhJnueija3G9I2i0h3g==", - "requires": { - "minimist": "~0.0.1", - "wordwrap": "~0.0.2" - } - }, "optionator": { "version": "0.8.3", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", @@ -8968,11 +8941,6 @@ "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", "dev": true }, - "wordwrap": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", - "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=" - }, "workerpool": { "version": "6.2.1", "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz", diff --git a/package.json b/package.json index 9221d54..194604e 100644 --- a/package.json +++ b/package.json @@ -41,8 +41,8 @@ "@homebridge/long": "^5.2.1", "event-stream": "^4.0.0", "hexy": "^0.2.10", - "optimist": "^0.6.1", - "@homebridge/put": "0.0.7", + "minimist": "^1.2.6", + "@homebridge/put": "~0.0.8", "safe-buffer": "^5.1.1", "xml2js": "^0.4.17" }, @@ -52,6 +52,7 @@ } }, "devDependencies": { + "@types/minimist": "^1.2.2", "eslint": "^6.0.0", "eslint-config-prettier": "^3.0.0", "eslint-plugin-markdown": "^3.0.0",