From 81862d4fa174372ea944d1cb3c2d68b7739ff637 Mon Sep 17 00:00:00 2001 From: Asher Date: Wed, 10 Jul 2019 18:33:18 -0500 Subject: [PATCH] Add back (most of) our old arguments Also remove VS Code ones that don't work. --- cli.ts | 58 ++++++++++++++++++++++++++++++++++++++++++++-- scripts/tasks.bash | 2 +- 2 files changed, 57 insertions(+), 3 deletions(-) diff --git a/cli.ts b/cli.ts index 9e942c29..270c58f4 100644 --- a/cli.ts +++ b/cli.ts @@ -9,12 +9,60 @@ import { MainServer, WebviewServer } from "vs/server/server"; import "vs/server/tar"; interface Args extends ParsedArgs { + "allow-http"?: boolean; + cert?: string; + "cert-key"?: string; + "extra-builtin-extensions-dir"?: string; + "extra-extensions-dir"?: string; + host?: string; + "no-auth"?: boolean; + open?: string; port?: string; + socket?: string; "webview-port"?: string; + "webview-socket"?: string; } +// The last item is _ which is like -- so our options need to come before it. +const last = options.pop()!; + +// Remove options that won't work or don't make sense. +let i = options.length; +while (i--) { + switch (options[i].id) { + case "add": + case "diff": + case "file-uri": + case "folder-uri": + case "goto": + case "new-window": + case "reuse-window": + case "wait": + case "disable-gpu": + // TODO: pretty sure these don't work but not 100%. + case "max-memory": + case "prof-startup": + case "inspect-extensions": + case "inspect-brk-extensions": + options.splice(i, 1); + break; + } +} + +options.push({ id: "allow-http", type: "boolean", cat: "o", description: "Allow http connections." }); +options.push({ id: "cert", type: "string", cat: "o", description: "Path to certificate." }); +options.push({ id: "cert-key", type: "string", cat: "o", description: "Path to certificate key." }); +options.push({ id: "extra-builtin-extensions-dir", type: "string", cat: "o", description: "Path to extra builtin extension directory." }); +options.push({ id: "extra-extensions-dir", type: "string", cat: "o", description: "Path to extra user extension directory." }); +options.push({ id: "host", type: "string", cat: "o", description: "Host for the main and webview servers." }); +options.push({ id: "no-auth", type: "string", cat: "o", description: "Disable password authentication." }); +options.push({ id: "open", type: "boolean", cat: "o", description: "Open in the browser on startup." }); options.push({ id: "port", type: "string", cat: "o", description: "Port for the main server." }); +options.push({ id: "socket", type: "string", cat: "o", description: "Listen on a socket instead of host:port." }); options.push({ id: "webview-port", type: "string", cat: "o", description: "Port for the webview server." }); +options.push({ id: "webview-socket", type: "string", cat: "o", description: "Listen on a socket instead of host:port." }); + +options.push(last); interface IMainCli { main: (argv: ParsedArgs) => Promise; @@ -32,13 +80,19 @@ const main = async (): Promise => { }; } + const version = `${(pkg as any).codeServerVersion || "development"}-vsc${pkg.version}`; if (args.help) { const executable = `${product.applicationName}${os.platform() === "win32" ? ".exe" : ""}`; - return console.log(buildHelpMessage(product.nameLong, executable, pkg.version)); + return console.log(buildHelpMessage( + product.nameLong, executable, + version, + undefined, + false, + )); } if (args.version) { - return console.log(buildVersionMessage(pkg.version, product.commit)); + return console.log(buildVersionMessage(version, product.commit)); } const shouldSpawnCliProcess = (): boolean => { diff --git a/scripts/tasks.bash b/scripts/tasks.bash index 2d1106a5..b1ee8cc1 100755 --- a/scripts/tasks.bash +++ b/scripts/tasks.bash @@ -218,7 +218,7 @@ function binary-task() { node "${rootPath}/scripts/nbin.js" "${target}" "${arch}" "${codeServerBuildPath}" rm node_modules/@coder/nbin mv "${codeServerBuildPath}/code-server" "${buildPath}/${binaryName}" - log "Binary at ${buildPath}/${binaryName}" + log "Binary: ${buildPath}/${binaryName}" } function main() {