style: format windows argv helpers
This commit is contained in:
@@ -52,7 +52,8 @@ export async function runCli(argv: string[] = process.argv) {
|
|||||||
function stripWindowsNodeExec(argv: string[]): string[] {
|
function stripWindowsNodeExec(argv: string[]): string[] {
|
||||||
if (process.platform !== "win32") return argv;
|
if (process.platform !== "win32") return argv;
|
||||||
const normalizeArg = (value: string): string => value.replace(/^"+|"+$/g, "");
|
const normalizeArg = (value: string): string => value.replace(/^"+|"+$/g, "");
|
||||||
const normalizeCandidate = (value: string): string => normalizeArg(value).replace(/^\\\\\\?\\/, "");
|
const normalizeCandidate = (value: string): string =>
|
||||||
|
normalizeArg(value).replace(/^\\\\\\?\\/, "");
|
||||||
const execPath = normalizeCandidate(process.execPath);
|
const execPath = normalizeCandidate(process.execPath);
|
||||||
const execPathLower = execPath.toLowerCase();
|
const execPathLower = execPath.toLowerCase();
|
||||||
const execBase = path.basename(execPath).toLowerCase();
|
const execBase = path.basename(execPath).toLowerCase();
|
||||||
|
|||||||
@@ -61,7 +61,8 @@ function normalizeWindowsArgv(argv: string[]): string[] {
|
|||||||
if (process.platform !== "win32") return argv;
|
if (process.platform !== "win32") return argv;
|
||||||
if (argv.length < 3) return argv;
|
if (argv.length < 3) return argv;
|
||||||
const normalizeArg = (value: string): string => value.replace(/^"+|"+$/g, "");
|
const normalizeArg = (value: string): string => value.replace(/^"+|"+$/g, "");
|
||||||
const normalizeCandidate = (value: string): string => normalizeArg(value).replace(/^\\\\\\?\\/, "");
|
const normalizeCandidate = (value: string): string =>
|
||||||
|
normalizeArg(value).replace(/^\\\\\\?\\/, "");
|
||||||
const execPath = normalizeCandidate(process.execPath);
|
const execPath = normalizeCandidate(process.execPath);
|
||||||
const execPathLower = execPath.toLowerCase();
|
const execPathLower = execPath.toLowerCase();
|
||||||
const execBase = path.basename(execPath).toLowerCase();
|
const execBase = path.basename(execPath).toLowerCase();
|
||||||
|
|||||||
Reference in New Issue
Block a user