-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/usr/bin/env node | ||
export {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env node | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const commander_1 = require("commander"); | ||
const driver_1 = require("../driver"); | ||
commander_1.program | ||
.name('litra-devices') | ||
.description('Lists Litra devices connected to your computer') | ||
.option('--json', 'output the list of devices in structured JSON format'); | ||
commander_1.program.parse(); | ||
const { json } = commander_1.program.opts(); | ||
const devices = (0, driver_1.findDevices)(); | ||
if (json) { | ||
console.log(JSON.stringify(devices.map((device) => ({ | ||
name: (0, driver_1.getNameForDevice)(device), | ||
serial_number: device.serialNumber, | ||
})))); | ||
} | ||
else { | ||
if (devices.length) { | ||
for (const device of devices) { | ||
console.log(`- ${(0, driver_1.getNameForDevice)(device)} (${device.serialNumber})`); | ||
} | ||
} | ||
else { | ||
console.log('No devices found'); | ||
} | ||
} | ||
process.exit(0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/usr/bin/env node | ||
export {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env node | ||
import { program } from 'commander'; | ||
import { findDevices, getNameForDevice } from '../driver'; | ||
program | ||
.name('litra-devices') | ||
.description('Lists Litra devices connected to your computer') | ||
.option('--json', 'output the list of devices in structured JSON format'); | ||
program.parse(); | ||
const { json } = program.opts(); | ||
const devices = findDevices(); | ||
if (json) { | ||
console.log(JSON.stringify(devices.map((device) => ({ | ||
name: getNameForDevice(device), | ||
serial_number: device.serialNumber, | ||
})))); | ||
} | ||
else { | ||
if (devices.length) { | ||
for (const device of devices) { | ||
console.log(`- ${getNameForDevice(device)} (${device.serialNumber})`); | ||
} | ||
} | ||
else { | ||
console.log('No devices found'); | ||
} | ||
} | ||
process.exit(0); |