From e44ac0a30ebcc5a829af953927813dedf707b689 Mon Sep 17 00:00:00 2001 From: Asher Date: Thu, 20 Feb 2020 18:44:03 -0600 Subject: [PATCH] Use last positional argument as working directory Instead of the first. --- src/node/app/vscode.ts | 2 +- test/cli.test.ts | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/node/app/vscode.ts b/src/node/app/vscode.ts index 2f1132e04..1bf525150 100644 --- a/src/node/app/vscode.ts +++ b/src/node/app/vscode.ts @@ -178,7 +178,7 @@ export class VscodeHttpProvider extends HttpProvider { { url: route.query.workspace, workspace: true }, { url: route.query.folder, workspace: false }, lastVisited, - this.args._ && this.args._.length > 0 ? { url: this.args._[0] } : undefined, + this.args._ && this.args._.length > 0 ? { url: this.args._[this.args._.length - 1] } : undefined, ], remoteAuthority, ) diff --git a/test/cli.test.ts b/test/cli.test.ts index 6bb4e07a6..9de3900eb 100644 --- a/test/cli.test.ts +++ b/test/cli.test.ts @@ -151,4 +151,13 @@ describe("cli", () => { }) assert.throws(() => parse(["--cert", "--socket-path-value"]), /Unknown option --socket-path-value/) }) + + it("should allow positional arguments before options", () => { + assert.deepEqual(parse(["foo", "test", "--auth", "none"]), { + _: ["foo", "test"], + "extensions-dir": path.join(xdgLocalDir, "extensions"), + "user-data-dir": xdgLocalDir, + auth: "none", + }) + }) })