Skip to content

Commit 7ec01e2

Browse files
committed
Remove unused runtime parameter from plan helper functions
1 parent 2ade037 commit 7ec01e2

1 file changed

Lines changed: 15 additions & 24 deletions

File tree

apps/server/src/open.ts

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@ function shouldPreferWindowsOpenerOnWsl(input: OpenExternalInput, runtime: OpenR
185185
}
186186

187187
function makeLaunchPlan(
188-
runtime: OpenRuntime,
189188
command: string,
190189
args: ReadonlyArray<string>,
191190
options: {
@@ -207,7 +206,7 @@ function makeLaunchPlan(
207206
};
208207
}
209208

210-
function makeDarwinDefaultPlan(input: OpenExternalInput, runtime: OpenRuntime): LaunchPlan {
209+
function makeDarwinDefaultPlan(input: OpenExternalInput): LaunchPlan {
211210
const args: string[] = [];
212211
const wait = input.wait ?? false;
213212

@@ -216,7 +215,7 @@ function makeDarwinDefaultPlan(input: OpenExternalInput, runtime: OpenRuntime):
216215
if (input.newInstance) args.push("--new");
217216
args.push(input.target);
218217

219-
return makeLaunchPlan(runtime, "open", args, {
218+
return makeLaunchPlan("open", args, {
220219
wait,
221220
allowNonzeroExitCode: input.allowNonzeroExitCode ?? false,
222221
shell: false,
@@ -226,7 +225,6 @@ function makeDarwinDefaultPlan(input: OpenExternalInput, runtime: OpenRuntime):
226225
function makeDarwinApplicationPlan(
227226
input: OpenExternalInput,
228227
app: { readonly name: string; readonly arguments: ReadonlyArray<string> },
229-
runtime: OpenRuntime,
230228
): LaunchPlan {
231229
const args: string[] = [];
232230
const wait = input.wait ?? false;
@@ -240,26 +238,21 @@ function makeDarwinApplicationPlan(
240238
args.push("--args", ...app.arguments);
241239
}
242240

243-
return makeLaunchPlan(runtime, "open", args, {
241+
return makeLaunchPlan("open", args, {
244242
wait,
245243
allowNonzeroExitCode: input.allowNonzeroExitCode ?? false,
246244
shell: false,
247245
});
248246
}
249247

250-
function makePowerShellPlan(
251-
input: OpenExternalInput,
252-
runtime: OpenRuntime,
253-
powerShellCommand: string,
254-
): LaunchPlan {
248+
function makePowerShellPlan(input: OpenExternalInput, powerShellCommand: string): LaunchPlan {
255249
const encodedParts = ["Start"];
256250
const wait = input.wait ?? false;
257251

258252
if (wait) encodedParts.push("-Wait");
259253
encodedParts.push(quotePowerShellValue(input.target));
260254

261255
return makeLaunchPlan(
262-
runtime,
263256
powerShellCommand,
264257
[
265258
"-NoProfile",
@@ -277,9 +270,9 @@ function makePowerShellPlan(
277270
);
278271
}
279272

280-
function makeLinuxDefaultPlan(input: OpenExternalInput, runtime: OpenRuntime): LaunchPlan {
273+
function makeLinuxDefaultPlan(input: OpenExternalInput): LaunchPlan {
281274
const wait = input.wait ?? false;
282-
return makeLaunchPlan(runtime, "xdg-open", [input.target], {
275+
return makeLaunchPlan("xdg-open", [input.target], {
283276
wait,
284277
allowNonzeroExitCode: input.allowNonzeroExitCode ?? false,
285278
detached: !wait,
@@ -288,8 +281,8 @@ function makeLinuxDefaultPlan(input: OpenExternalInput, runtime: OpenRuntime): L
288281
});
289282
}
290283

291-
function makeWindowsExplorerPlan(input: OpenExternalInput, runtime: OpenRuntime): LaunchPlan {
292-
return makeLaunchPlan(runtime, "explorer", [input.target], {
284+
function makeWindowsExplorerPlan(input: OpenExternalInput): LaunchPlan {
285+
return makeLaunchPlan("explorer", [input.target], {
293286
wait: false,
294287
allowNonzeroExitCode: false,
295288
shell: false,
@@ -299,9 +292,8 @@ function makeWindowsExplorerPlan(input: OpenExternalInput, runtime: OpenRuntime)
299292
function makeDirectApplicationPlan(
300293
input: OpenExternalInput,
301294
app: { readonly name: string; readonly arguments: ReadonlyArray<string> },
302-
runtime: OpenRuntime,
303295
): LaunchPlan {
304-
return makeLaunchPlan(runtime, app.name, [...app.arguments, input.target], {
296+
return makeLaunchPlan(app.name, [...app.arguments, input.target], {
305297
wait: input.wait ?? false,
306298
allowNonzeroExitCode: input.allowNonzeroExitCode ?? false,
307299
shell: false,
@@ -319,32 +311,32 @@ function resolveExternalPlans(
319311
for (const app of appCandidates) {
320312
if (app) {
321313
if (runtime.platform === "darwin") {
322-
plans.push(makeDarwinApplicationPlan(input, app, runtime));
314+
plans.push(makeDarwinApplicationPlan(input, app));
323315
} else {
324-
plans.push(makeDirectApplicationPlan(input, app, runtime));
316+
plans.push(makeDirectApplicationPlan(input, app));
325317
}
326318
continue;
327319
}
328320

329321
if (runtime.platform === "darwin") {
330-
plans.push(makeDarwinDefaultPlan(input, runtime));
322+
plans.push(makeDarwinDefaultPlan(input));
331323
continue;
332324
}
333325

334326
if (runtime.platform === "win32" || preferWindowsOpenerOnWsl) {
335327
for (const powerShellCommand of runtime.powerShellCandidates) {
336-
plans.push(makePowerShellPlan(input, runtime, powerShellCommand));
328+
plans.push(makePowerShellPlan(input, powerShellCommand));
337329
}
338330
}
339331

340332
if (runtime.platform === "win32") {
341333
if (!(input.wait ?? false)) {
342-
plans.push(makeWindowsExplorerPlan(input, runtime));
334+
plans.push(makeWindowsExplorerPlan(input));
343335
}
344336
continue;
345337
}
346338

347-
plans.push(makeLinuxDefaultPlan(input, runtime));
339+
plans.push(makeLinuxDefaultPlan(input));
348340
}
349341

350342
return plans;
@@ -654,7 +646,6 @@ const makeOpen = (options: OpenRuntimeOptions = {}) =>
654646
return runFirstAvailablePlan(
655647
[
656648
makeLaunchPlan(
657-
runtime,
658649
editor.command,
659650
shouldUseGotoFlag(editor, input.cwd) ? ["--goto", input.cwd] : [input.cwd],
660651
{

0 commit comments

Comments
 (0)