mirror of
https://github.com/morluto/rea.git
synced 2026-12-03 13:41:17 -05:00
23 lines
774 B
TypeScript
23 lines
774 B
TypeScript
import { join } from "node:path";
|
|
|
|
import { childHomeEnvironment } from "../../support/cli/childHome.js";
|
|
import type { TestCli } from "../../support/cli/cliFixture.js";
|
|
|
|
/** Run setup, doctor or uninstall against one test-owned home. */
|
|
export const setupCliInHome =
|
|
(cli: TestCli, home: string, config?: "claude" | "xdg" | "claude-and-xdg") =>
|
|
(arguments_: readonly string[]) =>
|
|
cli.run({
|
|
arguments: arguments_,
|
|
cwd: home,
|
|
environment: {
|
|
...childHomeEnvironment(home),
|
|
...(config === "claude" || config === "claude-and-xdg"
|
|
? { CLAUDE_CONFIG_DIR: home }
|
|
: {}),
|
|
...(config === "xdg" || config === "claude-and-xdg"
|
|
? { XDG_CONFIG_HOME: join(home, ".config") }
|
|
: {}),
|
|
},
|
|
});
|