@lvfarias/fl-cli
Version:
Flutter CLI
46 lines (42 loc) • 771 B
JavaScript
const { spawn } = require('child_process');
const flutterCommands = [
'analyze',
'attach',
'bash',
'build',
'channel',
'clean',
'config',
'create',
'devices',
'doctor',
'drive',
'emulators',
'format',
'help',
'install',
'logs',
'make',
'precache',
'pub',
'run',
'screenshot',
'test',
'upgrade',
'version',
];
function isValidCommand(name) {
return flutterCommands.includes(name);
}
function execute(name) {
const command = spawn('flutter', [name]);
command.stdout.on('data', data => {
console.log(''+data);
});
command.stderr.on('data', data => {});
command.on('close', code => {});
}
module.exports = {
execute,
isValidCommand,
};