Add list-devices option to list the available devices.
Summary: This diff adds an option of `--list-devices` which will list the currently active devices on the machine. It will be later used to select a device by passing an `id` as an argument. Reviewed By: danielbuechele Differential Revision: D15524250 fbshipit-source-id: 7a79ceb1e431a25adcb4e05bc0cb68407c527806
This commit is contained in:
committed by
Facebook Github Bot
parent
53b852dbe6
commit
c94c2c8455
@@ -17,7 +17,7 @@ import {
|
||||
exportMetricsWithoutTrace,
|
||||
exportMetricsFromTrace,
|
||||
} from '../src/utils/exportMetrics.js';
|
||||
|
||||
import {listDevices} from '../src/utils/listDevices';
|
||||
// $FlowFixMe this file exist, trust me, flow!
|
||||
import setup from '../static/setup.js';
|
||||
|
||||
@@ -60,6 +60,12 @@ yargs
|
||||
describe: 'Will export metrics instead of data when flipper terminates',
|
||||
type: 'string',
|
||||
});
|
||||
yargs.option('list-devices', {
|
||||
alias: 'showDevices',
|
||||
default: false,
|
||||
describe: 'Will print the list of devices in the terminal',
|
||||
type: 'boolean',
|
||||
});
|
||||
},
|
||||
startFlipper,
|
||||
)
|
||||
@@ -77,6 +83,7 @@ async function startFlipper({
|
||||
dev,
|
||||
verbose,
|
||||
metrics,
|
||||
showDevices,
|
||||
exit,
|
||||
'insecure-port': insecurePort,
|
||||
'secure-port': securePort,
|
||||
@@ -145,8 +152,15 @@ async function startFlipper({
|
||||
devToolsEnhancer.composeWithDevTools(applyMiddleware(headlessMiddleware)),
|
||||
);
|
||||
const logger = initLogger(store, {isHeadless: true});
|
||||
dispatcher(store, logger);
|
||||
|
||||
//TODO: T45068486 Refactor this function into separate components.
|
||||
if (showDevices) {
|
||||
const devices = await listDevices();
|
||||
originalConsole.log(devices);
|
||||
process.exit();
|
||||
}
|
||||
|
||||
dispatcher(store, logger);
|
||||
if (shouldExportMetric(metrics) && metrics && metrics.length > 0) {
|
||||
try {
|
||||
const payload = await exportMetricsFromTrace(metrics, store.getState());
|
||||
|
||||
Reference in New Issue
Block a user