diff --git a/bin/cli.js b/bin/cli.js index 936c0af..bd64b5c 100755 --- a/bin/cli.js +++ b/bin/cli.js @@ -17,6 +17,8 @@ const args = require('yargs') .describe('filter', 'Filter files by name') .describe('force', 'Skip the cache or force an operation') .describe('id', 'Pass a device id to limit to one') + .describe('json', 'Print JSON output') + .describe('keys', 'Alone shows all keys in message, pass a comma-sep list of keys to print') .describe('parse', 'Parse a 3mf file after download') .describe('upload', 'Upload a file [--upload=./foo.gcode.3mf]') .describe('yes', 'Auto select YES when prompted') @@ -25,6 +27,7 @@ const args = require('yargs') .command('login', 'Login and fetch machine information') .command('ls', 'Alias for machines') .command('machines', 'List current known machines') + .command('mqtt', 'Show mqtt messages [--keys] [--json] (--json --keys ams,vt_tray)') .command('parse', 'Parse details from a .3mf file [--file] [--force]') //.command('print', 'Pass file name on printer to print [--file]') .command('status', 'Check machine connectivity [--id to get detailed info]') diff --git a/lib/mqtt.js b/lib/mqtt.js index 3c62341..63e094e 100644 --- a/lib/mqtt.js +++ b/lib/mqtt.js @@ -31,7 +31,7 @@ module.exports = (args) => { const command = json[key].command; //console.log(`[${machine.id}] (${topic}): ${command}`, JSON.stringify(json)); console.log(`[${machine.id}] (${topic}): ${command} (keys: ${Object.keys(json[key]).length})`); - if (args.json) { + if (args.json && args.keys !== true) { if (args.keys) { if (!Array.isArray(args.keys)) { args.keys = args.keys.split(',');