From b9aed71a5c5c0f84161935cd44a0c2be8fbedbc4 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Wed, 15 Jul 2020 15:12:01 -0700 Subject: [PATCH] Added --hex option to MeshCtrl.js listdevicegroups. --- meshctrl.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/meshctrl.js b/meshctrl.js index da2f80f8..9b99f419 100644 --- a/meshctrl.js +++ b/meshctrl.js @@ -252,6 +252,7 @@ if (args['_'].length == 0) { console.log(" --idexists [id] - Return 1 if id exists, 0 if not."); console.log(" --nameexists [name] - Return id if name exists."); console.log(" --emailexists [email] - Return id if email exists."); + console.log(" --hex - Display meshid in hex format."); console.log(" --json - Show result as JSON."); break; } @@ -1020,7 +1021,9 @@ function serverConnect() { console.log('id, name\r\n---------------'); for (var i in data.meshes) { const m = data.meshes[i]; - var t = "\"" + m._id.split('/')[2] + "\", \"" + m.name + "\""; + var mid = m._id.split('/')[2]; + if (args.hex) { mid = Buffer.from(mid.replace(/\@/g, '+').replace(/\$/g, '/'), 'base64').toString('hex').toUpperCase(); } + var t = "\"" + mid + "\", \"" + m.name + "\""; console.log(t); } }