Add --ignore-last-opened option (#2434)

This allows bypassing the last opened behavior for certain cases where that's not desirable.

Fixes #1951
This commit is contained in:
JammSpread 2020-12-15 11:22:58 -05:00 committed by GitHub
parent 7e05ca09bb
commit f4ca41329a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -52,6 +52,7 @@ export interface Args extends VsArgs {
"proxy-domain"?: string[] "proxy-domain"?: string[]
locale?: string locale?: string
_: string[] _: string[]
"ignore-last-opened"?: boolean
"reuse-window"?: boolean "reuse-window"?: boolean
"new-window"?: boolean "new-window"?: boolean
@ -171,7 +172,11 @@ const options: Options<Required<Args>> = {
"uninstall-extension": { type: "string[]", description: "Uninstall a VS Code extension by id." }, "uninstall-extension": { type: "string[]", description: "Uninstall a VS Code extension by id." },
"show-versions": { type: "boolean", description: "Show VS Code extension versions." }, "show-versions": { type: "boolean", description: "Show VS Code extension versions." },
"proxy-domain": { type: "string[]", description: "Domain used for proxying ports." }, "proxy-domain": { type: "string[]", description: "Domain used for proxying ports." },
"ignore-last-opened": {
type: "boolean",
short: "e",
description: "Ignore the last opened directory or workspace in favor of an empty window."
},
"new-window": { "new-window": {
type: "boolean", type: "boolean",
short: "n", short: "n",

View File

@ -43,7 +43,7 @@ export class VscodeProvider {
options.args._ && options.args._.length > 0 options.args._ && options.args._.length > 0
? { url: path.resolve(options.args._[options.args._.length - 1]) } ? { url: path.resolve(options.args._[options.args._.length - 1]) }
: undefined, : undefined,
lastVisited, !options.args["ignore-last-opened"] ? lastVisited : undefined,
]) ])
settings.write({ settings.write({