chore: migrate to oxlint and oxfmt
Co-authored-by: Christoph Nakazawa <christoph.pojer@gmail.com>
This commit is contained in:
@@ -10,17 +10,9 @@ import {
|
||||
} from "../config/config.js";
|
||||
import { resolveGatewayService } from "../daemon/service.js";
|
||||
import type { RuntimeEnv } from "../runtime.js";
|
||||
import {
|
||||
stylePromptHint,
|
||||
stylePromptMessage,
|
||||
stylePromptTitle,
|
||||
} from "../terminal/prompt-style.js";
|
||||
import { stylePromptHint, stylePromptMessage, stylePromptTitle } from "../terminal/prompt-style.js";
|
||||
import { resolveHomeDir } from "../utils.js";
|
||||
import {
|
||||
collectWorkspaceDirs,
|
||||
isPathWithin,
|
||||
removePath,
|
||||
} from "./cleanup-utils.js";
|
||||
import { collectWorkspaceDirs, isPathWithin, removePath } from "./cleanup-utils.js";
|
||||
|
||||
type UninstallScope = "service" | "state" | "workspace" | "app";
|
||||
|
||||
@@ -40,9 +32,7 @@ const multiselectStyled = <T>(params: Parameters<typeof multiselect<T>>[0]) =>
|
||||
...params,
|
||||
message: stylePromptMessage(params.message),
|
||||
options: params.options.map((opt) =>
|
||||
opt.hint === undefined
|
||||
? opt
|
||||
: { ...opt, hint: stylePromptHint(opt.hint) },
|
||||
opt.hint === undefined ? opt : { ...opt, hint: stylePromptHint(opt.hint) },
|
||||
),
|
||||
});
|
||||
|
||||
@@ -50,9 +40,7 @@ function buildScopeSelection(opts: UninstallOptions): {
|
||||
scopes: Set<UninstallScope>;
|
||||
hadExplicit: boolean;
|
||||
} {
|
||||
const hadExplicit = Boolean(
|
||||
opts.all || opts.service || opts.state || opts.workspace || opts.app,
|
||||
);
|
||||
const hadExplicit = Boolean(opts.all || opts.service || opts.state || opts.workspace || opts.app);
|
||||
const scopes = new Set<UninstallScope>();
|
||||
if (opts.all || opts.service) scopes.add("service");
|
||||
if (opts.all || opts.state) scopes.add("state");
|
||||
@@ -101,10 +89,7 @@ async function removeMacApp(runtime: RuntimeEnv, dryRun?: boolean) {
|
||||
});
|
||||
}
|
||||
|
||||
export async function uninstallCommand(
|
||||
runtime: RuntimeEnv,
|
||||
opts: UninstallOptions,
|
||||
) {
|
||||
export async function uninstallCommand(runtime: RuntimeEnv, opts: UninstallOptions) {
|
||||
const { scopes, hadExplicit } = buildScopeSelection(opts);
|
||||
const interactive = !opts.nonInteractive;
|
||||
if (!interactive && !opts.yes) {
|
||||
@@ -115,9 +100,7 @@ export async function uninstallCommand(
|
||||
|
||||
if (!hadExplicit) {
|
||||
if (!interactive) {
|
||||
runtime.error(
|
||||
"Non-interactive mode requires explicit scopes (use --all).",
|
||||
);
|
||||
runtime.error("Non-interactive mode requires explicit scopes (use --all).");
|
||||
runtime.exit(1);
|
||||
return;
|
||||
}
|
||||
@@ -140,9 +123,7 @@ export async function uninstallCommand(
|
||||
initialValues: ["service", "state", "workspace"],
|
||||
});
|
||||
if (isCancel(selection)) {
|
||||
cancel(
|
||||
stylePromptTitle("Uninstall cancelled.") ?? "Uninstall cancelled.",
|
||||
);
|
||||
cancel(stylePromptTitle("Uninstall cancelled.") ?? "Uninstall cancelled.");
|
||||
runtime.exit(0);
|
||||
return;
|
||||
}
|
||||
@@ -159,9 +140,7 @@ export async function uninstallCommand(
|
||||
message: stylePromptMessage("Proceed with uninstall?"),
|
||||
});
|
||||
if (isCancel(ok) || !ok) {
|
||||
cancel(
|
||||
stylePromptTitle("Uninstall cancelled.") ?? "Uninstall cancelled.",
|
||||
);
|
||||
cancel(stylePromptTitle("Uninstall cancelled.") ?? "Uninstall cancelled.");
|
||||
runtime.exit(0);
|
||||
return;
|
||||
}
|
||||
@@ -208,13 +187,8 @@ export async function uninstallCommand(
|
||||
|
||||
if (scopes.has("state") && !scopes.has("workspace")) {
|
||||
const home = resolveHomeDir();
|
||||
if (
|
||||
home &&
|
||||
workspaceDirs.some((dir) => dir.startsWith(path.resolve(home)))
|
||||
) {
|
||||
runtime.log(
|
||||
"Tip: workspaces were preserved. Re-run with --workspace to remove them.",
|
||||
);
|
||||
if (home && workspaceDirs.some((dir) => dir.startsWith(path.resolve(home)))) {
|
||||
runtime.log("Tip: workspaces were preserved. Re-run with --workspace to remove them.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user