Plugin name list
Summary: Adds an argument to the headless Flipper to print the list of available plugins. Added `--list-plugins`. Currently the startFlipper function is not scalable enough to add new arguments and its implementation. I am planning to tackle this with the list of Actions which will be closure. So adding a new argument with its implementation will be just appending a closure at the correct location in an array. Will work on that in the later diff stacked on the current one. Reviewed By: jknoxville Differential Revision: D15789778 fbshipit-source-id: 91ba472617d593c3490bb932590a06d83597cba7
This commit is contained in:
committed by
Facebook Github Bot
parent
198841d1d7
commit
e5294d34f0
@@ -21,6 +21,8 @@ import {listDevices} from '../src/utils/listDevices';
|
||||
// $FlowFixMe this file exist, trust me, flow!
|
||||
import setup from '../static/setup.js';
|
||||
import type {Store} from '../src/reducers';
|
||||
import {getActivePluginNames} from '../src/utils/pluginUtils.js';
|
||||
import {serialize} from '../src/utils/serialization';
|
||||
|
||||
type UserArguments = {|
|
||||
securePort: string,
|
||||
@@ -31,6 +33,7 @@ type UserArguments = {|
|
||||
metrics: string,
|
||||
listDevices: boolean,
|
||||
device: string,
|
||||
listPlugins: boolean,
|
||||
|};
|
||||
|
||||
yargs
|
||||
@@ -76,6 +79,11 @@ yargs
|
||||
describe: 'Will print the list of devices in the terminal',
|
||||
type: 'boolean',
|
||||
});
|
||||
yargs.option('list-plugins', {
|
||||
default: false,
|
||||
describe: 'Will print the list of supported plugins in the terminal',
|
||||
type: 'boolean',
|
||||
});
|
||||
yargs.option('device', {
|
||||
default: undefined,
|
||||
describe:
|
||||
@@ -122,12 +130,16 @@ async function exitActions(
|
||||
originalConsole: typeof global.console,
|
||||
store: Store,
|
||||
): Promise<void> {
|
||||
if (userArguments.listPlugins) {
|
||||
outputAndExit(serialize(getActivePluginNames(store.getState().plugins)));
|
||||
}
|
||||
|
||||
const {metrics, exit} = userArguments;
|
||||
if (shouldExportMetric(metrics) && metrics && metrics.length > 0) {
|
||||
try {
|
||||
const payload = await exportMetricsFromTrace(
|
||||
metrics,
|
||||
pluginsClassMap(store.getState()),
|
||||
pluginsClassMap(store.getState().plugins),
|
||||
);
|
||||
outputAndExit(payload.toString());
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user