CLI: add config path subcommand to print active config file path (#26256)
Merged via squash. Prepared head SHA: b11c593a34c5730f4244c054e1d1ab536953b0ef Co-authored-by: cyb1278588254 <48212932+cyb1278588254@users.noreply.github.com> Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Reviewed-by: @gumadeiras
This commit is contained in:
@@ -288,4 +288,27 @@ describe("config cli", () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("config file", () => {
|
||||
it("prints the active config file path", async () => {
|
||||
const resolved: OpenClawConfig = { gateway: { port: 18789 } };
|
||||
setSnapshot(resolved, resolved);
|
||||
|
||||
await runConfigCommand(["config", "file"]);
|
||||
|
||||
expect(mockLog).toHaveBeenCalledWith("/tmp/openclaw.json");
|
||||
expect(mockWriteConfigFile).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("handles config file path with home directory", async () => {
|
||||
const resolved: OpenClawConfig = { gateway: { port: 18789 } };
|
||||
const snapshot = buildSnapshot({ resolved, config: resolved });
|
||||
snapshot.path = "/home/user/.openclaw/openclaw.json";
|
||||
mockReadConfigFileSnapshot.mockResolvedValueOnce(snapshot);
|
||||
|
||||
await runConfigCommand(["config", "file"]);
|
||||
|
||||
expect(mockLog).toHaveBeenCalledWith("/home/user/.openclaw/openclaw.json");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user