From a673cf283340c4dcde2e6177d22a68a04d396d6a Mon Sep 17 00:00:00 2001 From: Joe Previte Date: Mon, 20 Sep 2021 15:14:46 -0700 Subject: [PATCH] refactor: shouldRunVsCodeCli --- src/node/cli.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/node/cli.ts b/src/node/cli.ts index a2fac418..aea8e3d9 100644 --- a/src/node/cli.ts +++ b/src/node/cli.ts @@ -626,7 +626,20 @@ function bindAddrFromAllSources(...argsConfig: Args[]): Addr { } export const shouldRunVsCodeCli = (args: Args): boolean => { - return !!args["list-extensions"] || !!args["install-extension"] || !!args["uninstall-extension"] + // Create new interface with only these keys + // Pick + // Get the keys of new interface + // keyof ... + // Turn that into an array + // Array<...> + type ExtensionArgs = Array> + const extensionRelatedArgs: ExtensionArgs = ["list-extensions", "install-extension", "uninstall-extension"] + + const argKeys = Object.keys(args) + + // If any of the extensionRelatedArgs are included in args + // then we don't want to run the vscode cli + return extensionRelatedArgs.some((arg) => argKeys.includes(arg)) } /**