mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-26 03:59:55 +00:00
Don't pass zed-local flags through to zed
This commit is contained in:
parent
7855a6357a
commit
5f5505fe9a
1 changed files with 23 additions and 10 deletions
|
@ -1,31 +1,44 @@
|
||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
const HELP = `
|
||||||
|
USAGE
|
||||||
|
zed-local [options] [zed args]
|
||||||
|
|
||||||
|
OPTIONS
|
||||||
|
--help Print this help message
|
||||||
|
--release Build Zed in release mode
|
||||||
|
-2, -3, -4 Spawn 2, 3, or 4 Zed instances, with their windows tiled.
|
||||||
|
--top Arrange the Zed windows so they take up the top half of the screen.
|
||||||
|
`.trim();
|
||||||
|
|
||||||
const { spawn, execFileSync } = require("child_process");
|
const { spawn, execFileSync } = require("child_process");
|
||||||
|
|
||||||
const RESOLUTION_REGEX = /(\d+) x (\d+)/;
|
const RESOLUTION_REGEX = /(\d+) x (\d+)/;
|
||||||
const DIGIT_FLAG_REGEX = /^--?(\d+)$/;
|
const DIGIT_FLAG_REGEX = /^--?(\d+)$/;
|
||||||
|
|
||||||
// Parse the number of Zed instances to spawn.
|
|
||||||
let instanceCount = 1;
|
let instanceCount = 1;
|
||||||
let isReleaseMode = false;
|
let isReleaseMode = false;
|
||||||
let isTop = false;
|
let isTop = false;
|
||||||
|
|
||||||
const args = process.argv.slice(2);
|
const args = process.argv.slice(2);
|
||||||
for (const arg of args) {
|
while (args.length > 0) {
|
||||||
|
const arg = args[0];
|
||||||
|
|
||||||
const digitMatch = arg.match(DIGIT_FLAG_REGEX);
|
const digitMatch = arg.match(DIGIT_FLAG_REGEX);
|
||||||
if (digitMatch) {
|
if (digitMatch) {
|
||||||
instanceCount = parseInt(digitMatch[1]);
|
instanceCount = parseInt(digitMatch[1]);
|
||||||
continue;
|
} else if (arg === "--release") {
|
||||||
}
|
|
||||||
|
|
||||||
if (arg == "--release") {
|
|
||||||
isReleaseMode = true;
|
isReleaseMode = true;
|
||||||
continue;
|
} else if (arg === "--top") {
|
||||||
|
isTop = true;
|
||||||
|
} else if (arg === "--help") {
|
||||||
|
console.log(HELP);
|
||||||
|
process.exit(0);
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arg == "--top") {
|
args.shift();
|
||||||
isTop = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse the resolution of the main screen
|
// Parse the resolution of the main screen
|
||||||
|
|
Loading…
Reference in a new issue