@v5x/cli 0.0.7 → 0.0.8
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.
- package/dist/index.js +13 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -118,7 +118,7 @@ var require_picocolors = __commonJS((exports, module) => {
|
|
|
118
118
|
// package.json
|
|
119
119
|
var package_default = {
|
|
120
120
|
name: "@v5x/cli",
|
|
121
|
-
version: "0.0.
|
|
121
|
+
version: "0.0.8",
|
|
122
122
|
description: "Command line interface for v5x.",
|
|
123
123
|
license: "MIT",
|
|
124
124
|
type: "module",
|
|
@@ -2645,7 +2645,7 @@ class VexSerialConnection extends VexEventTarget {
|
|
|
2645
2645
|
try {
|
|
2646
2646
|
port = await this.serial.requestPort({ filters: this.filters });
|
|
2647
2647
|
} catch (e) {
|
|
2648
|
-
|
|
2648
|
+
throw new Error("No valid port selected.");
|
|
2649
2649
|
}
|
|
2650
2650
|
}
|
|
2651
2651
|
if (port == null)
|
|
@@ -3789,15 +3789,19 @@ async function main() {
|
|
|
3789
3789
|
const device = new V5SerialDevice(serial);
|
|
3790
3790
|
try {
|
|
3791
3791
|
await device.connect();
|
|
3792
|
+
if (device.isConnected) {
|
|
3793
|
+
console.log("os:", device.brain.systemVersion.toUserString());
|
|
3794
|
+
console.log("name:", await device.brain.getValue("robotname"));
|
|
3795
|
+
console.log("team:", await device.brain.getValue("teamnumber"));
|
|
3796
|
+
console.log("id:", device.brain.uniqueId.toString());
|
|
3797
|
+
}
|
|
3792
3798
|
} catch {
|
|
3793
3799
|
console.warn(import_picocolors.default.yellow("v5 device not found"));
|
|
3794
|
-
}
|
|
3795
|
-
if (device.isConnected) {
|
|
3796
|
-
console.log("os:", device.brain.systemVersion.toUserString());
|
|
3797
|
-
console.log("name:", await device.brain.getValue("robotname"));
|
|
3798
|
-
console.log("team:", await device.brain.getValue("teamnumber"));
|
|
3799
|
-
console.log("id:", device.brain.uniqueId.toString());
|
|
3800
|
+
} finally {
|
|
3800
3801
|
await device.disconnect();
|
|
3801
3802
|
}
|
|
3802
3803
|
}
|
|
3803
|
-
main()
|
|
3804
|
+
main().then(() => process.exit(0), (error) => {
|
|
3805
|
+
console.error(error);
|
|
3806
|
+
process.exit(1);
|
|
3807
|
+
});
|