Skip to content

Commit

Permalink
added mqtt command
Browse files Browse the repository at this point in the history
  • Loading branch information
davglass committed Dec 24, 2023
1 parent 727402c commit 0f5ba2b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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]')
Expand Down
2 changes: 1 addition & 1 deletion lib/mqtt.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(',');
Expand Down

0 comments on commit 0f5ba2b

Please sign in to comment.