nep-cli 0.2.3 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/bin/index.js +11 -7
  2. package/package.json +2 -3
package/bin/index.js CHANGED
@@ -14,9 +14,10 @@ const open = require('open'); // Import the 'open' package
14
14
  const express = require('express');
15
15
  const http = require('http');
16
16
  const socketIo = require('socket.io');
17
- const fs = require('fs');
17
+ const fs = require ('fs');
18
18
  const zmqc = require("zeromq/v5-compat");
19
19
 
20
+
20
21
  const PORT_MASTER_INFO = 50001; // Default port for master info
21
22
  const PORT_SERVER = 50050;
22
23
 
@@ -26,6 +27,7 @@ program
26
27
  .version(version)
27
28
  .description('NEP-CLI')
28
29
 
30
+
29
31
  program
30
32
  .command('ip')
31
33
  .description('Display current Wi-Fi and Ethernet IP addresses of this computer')
@@ -515,7 +517,6 @@ program
515
517
  }
516
518
  });
517
519
 
518
-
519
520
  program
520
521
  .command('topics')
521
522
  .description('Displays the list of NEP+ topics')
@@ -569,15 +570,16 @@ program
569
570
  await getTopics(); // Call the function to get topics
570
571
  });
571
572
 
573
+
572
574
  program
573
575
  .command('show [topic] [index]')
574
576
  .description('Displays messages published to a specified NEP+ topic in the default browser. ' +
575
- 'The [index] parameter specifies the index of the message to display and must be a number between 0 and 49. '
577
+ 'The [index] parameter specifies the port index of the server that is connected to the web browser for displaying messages. It must be a number between 0 and 49'
576
578
  )
577
579
  .action(async (topic, index) => {
578
580
  const ip = "127.0.0.1";
579
581
 
580
- const allowedFormats = ["json", "msgpack", "bytes", "images", "dictionary", "string"];
582
+ const allowedFormats = ["json", "msgpack", "bytes", "images", "dictionary"];
581
583
  const master_ip = "127.0.0.1";
582
584
 
583
585
  const requester = createRequester(master_ip, PORT_MASTER_INFO);
@@ -598,7 +600,7 @@ program
598
600
  open(`http://localhost:${port}/?port=${port}&topic=${encodeURIComponent(topicid)}`);
599
601
  startShowServer(port, topic, ip);
600
602
  }
601
- else if (msg_type === "json" || msg_type === "dictionary") {
603
+ else if (msg_type === "json" || msg_type === "dictionary" || msg_type === "msgpack") {
602
604
  open(`http://localhost:${port}/?port=${port}&topic=${encodeURIComponent(topicid)}`);
603
605
  startJsonServer(port, topic, ip, msg_type);
604
606
  }
@@ -849,11 +851,13 @@ const selectTimeout = async (defaultTimeout = 1000) => {
849
851
  };
850
852
 
851
853
  program
852
- .command('record [topic] [msg_type] [timeout]')
854
+ .command('record [topic]')
853
855
  .description('Record messages from a NEP+ topic to a file')
854
- .action(async (topic, msg_type, timeout = 60000) => {
856
+ .action(async (topic) => {
855
857
  const allowedFormats = ["json", "msgpack", "bytes", "images", "dictionary", "string"];
856
858
  const master_ip = "127.0.0.1";
859
+ var msg_type = "";
860
+ var timeout = 10000;
857
861
 
858
862
  const requester = createRequester(master_ip, PORT_MASTER_INFO);
859
863
  const results = await sendRequest(requester, { "input": "topics" });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nep-cli",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "main": "./lib/nep.js",
5
5
  "bin": {
6
6
  "nep": "./bin/index.js"
@@ -12,10 +12,9 @@
12
12
  "commander": "^11.0.0",
13
13
  "enquirer": "^2.4.1",
14
14
  "express": "^4.18.2",
15
- "nep-js": "^0.3.8",
15
+ "nep-js": "^0.4.0",
16
16
  "open": "7.4.2",
17
17
  "socket.io": "^4.7.2",
18
- "vue": "^2.7.16",
19
18
  "zeromq": "6.0.0-beta.19"
20
19
  }
21
20
  }