[CmdSwitches] Rewrite cmd parsing to be simpler
This commit is contained in:
parent
513d004ce5
commit
f0f2d08f2c
1 changed files with 9 additions and 13 deletions
|
@ -8,18 +8,14 @@ const presets = {
|
||||||
|
|
||||||
|
|
||||||
module.exports = () => {
|
module.exports = () => {
|
||||||
for (const [ key, ...values ] of Object.values([ 'base', ...(oaConfig.cmdPreset || 'perf').split(',') ].reduce((acc, x) => {
|
let c = {};
|
||||||
for (const cmd of (presets[x] || '').split(' ')) {
|
for (const x of ('base,' + (oaConfig.cmdPreset || 'perf')).split(',').reduce((a, x) => a.concat(presets[x]?.split(' ')), [])) {
|
||||||
if (!cmd) continue;
|
const [ k, v ] = x.split('=');
|
||||||
|
|
||||||
const [ key, value ] = cmd.split('=');
|
(c[k] = c[k] || []).push(v);
|
||||||
|
}
|
||||||
if (!acc[key]) acc[key] = [key];
|
|
||||||
acc[key].push(value);
|
for (const k in c) {
|
||||||
}
|
app.commandLine.appendSwitch(k.replace('--', ''), c[k].join(','));
|
||||||
|
|
||||||
return acc;
|
|
||||||
}, {}))) {
|
|
||||||
app.commandLine.appendSwitch(key.replace('--', ''), values.join(','));
|
|
||||||
}
|
}
|
||||||
};
|
};
|
Loading…
Reference in a new issue