44 строки
1.0 KiB
JavaScript
Executable File
44 строки
1.0 KiB
JavaScript
Executable File
#!/usr/bin/env node
|
|
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
|
|
var simulateServer = require('taco-simulate-server');
|
|
|
|
var args;
|
|
try {
|
|
args = processArgs(process.argv);
|
|
require('./../src/simulate')({platform: args.platform, target: args.target}).catch(function (e) {
|
|
simulateServer.log.error(e);
|
|
});
|
|
} catch (e) {
|
|
simulateServer.log.error(e);
|
|
}
|
|
|
|
function processArgs(args) {
|
|
var platform = null;
|
|
var target = null;
|
|
|
|
args.shift(); // Remove 'node'
|
|
args.shift(); // Remove 'simulate'
|
|
|
|
args.forEach(function (arg) {
|
|
arg = arg.toLowerCase();
|
|
if (arg.indexOf('--target=') === 0) {
|
|
if (target) {
|
|
throw new Error('Target defined more than once');
|
|
}
|
|
target = arg.substring(9);
|
|
} else {
|
|
if (platform) {
|
|
throw new Error('Too many arguments');
|
|
}
|
|
platform = arg;
|
|
}
|
|
});
|
|
|
|
return {
|
|
platform: platform,
|
|
target: target
|
|
};
|
|
}
|