--help: document chromium & electron flags
This commit is contained in:
+37
-5
@@ -8,6 +8,13 @@ import { app } from "electron";
|
|||||||
import { stripIndent } from "shared/utils/text";
|
import { stripIndent } from "shared/utils/text";
|
||||||
import { parseArgs, ParseArgsOptionDescriptor } from "util";
|
import { parseArgs, ParseArgsOptionDescriptor } from "util";
|
||||||
|
|
||||||
|
type Option = ParseArgsOptionDescriptor & {
|
||||||
|
description: string;
|
||||||
|
hidden?: boolean;
|
||||||
|
options?: string[];
|
||||||
|
argumentName?: string;
|
||||||
|
};
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
"start-minimized": {
|
"start-minimized": {
|
||||||
default: false,
|
default: false,
|
||||||
@@ -35,10 +42,27 @@ const options = {
|
|||||||
description: "Set User-Agent to a specific operating system. May trigger anti-spam or break voice chat",
|
description: "Set User-Agent to a specific operating system. May trigger anti-spam or break voice chat",
|
||||||
options: ["windows", "linux", "darwin"]
|
options: ["windows", "linux", "darwin"]
|
||||||
}
|
}
|
||||||
} satisfies Record<
|
} satisfies Record<string, Option>;
|
||||||
string,
|
|
||||||
ParseArgsOptionDescriptor & { description: string; options?: string[]; argumentName?: string }
|
// only for help display
|
||||||
>;
|
const extraOptions = {
|
||||||
|
"enable-features": {
|
||||||
|
type: "string",
|
||||||
|
description: "Enable specific Chromium features",
|
||||||
|
argumentName: "feature1,feature2,…"
|
||||||
|
},
|
||||||
|
"disable-features": {
|
||||||
|
type: "string",
|
||||||
|
description: "Disable specific Chromium features",
|
||||||
|
argumentName: "feature1,feature2,…"
|
||||||
|
},
|
||||||
|
"ozone-platform": {
|
||||||
|
hidden: process.platform !== "linux",
|
||||||
|
type: "string",
|
||||||
|
description: "Whether to run Vesktop in Wayland or X11 (XWayland)",
|
||||||
|
options: ["x11", "wayland"]
|
||||||
|
}
|
||||||
|
} satisfies Record<string, Option>;
|
||||||
|
|
||||||
export const CommandLine = parseArgs({
|
export const CommandLine = parseArgs({
|
||||||
options,
|
options,
|
||||||
@@ -60,11 +84,19 @@ export function checkCommandLineForHelpOrVersion() {
|
|||||||
|
|
||||||
Usage: ${process.execPath} [options] [url]
|
Usage: ${process.execPath} [options] [url]
|
||||||
|
|
||||||
Options:
|
Electron Options:
|
||||||
|
See <https://www.electronjs.org/docs/latest/api/command-line-switches#electron-cli-flags>
|
||||||
|
|
||||||
|
Chromium Options:
|
||||||
|
See <https://peter.sh/experiments/chromium-command-line-switches> - only some of them work
|
||||||
|
|
||||||
|
Vesktop Options:
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const optionLines = Object.entries(options)
|
const optionLines = Object.entries(options)
|
||||||
.sort(([a], [b]) => a.localeCompare(b))
|
.sort(([a], [b]) => a.localeCompare(b))
|
||||||
|
.concat(Object.entries(extraOptions))
|
||||||
|
.filter(([, opt]) => !("hidden" in opt && opt.hidden))
|
||||||
.map(([name, opt]) => {
|
.map(([name, opt]) => {
|
||||||
const flags = [
|
const flags = [
|
||||||
"short" in opt && `-${opt.short}`,
|
"short" in opt && `-${opt.short}`,
|
||||||
|
|||||||
Reference in New Issue
Block a user