fix: make dry-run next steps executable
This commit is contained in:
1 parent
1571c524c1
commit
f26eae7b08
2 files changed
+6
-2
No files matched your search
@@ -36,6 +36,8 @@ describe("CLI mutation protocol", () => {
|
||||
expect(preview.dryRun).toBe(true);
|
||||
expect(preview.operation).toBe("同意单据审批");
|
||||
expect(preview.target).toBe("S26000001");
|
||||
expect(preview.nextAction).not.toContain("--dry-run");
|
||||
expect(preview.nextAction).toContain("--yes");
|
||||
});
|
||||
|
||||
test("bill write without confirmation is rejected before the API call", async () => {
|
||||
|
||||
+4
-2
@@ -52,12 +52,14 @@ export function mutationPreview(
|
||||
target: string,
|
||||
changes: Record<string, unknown>
|
||||
): CliResult {
|
||||
const confirmedArgs = parsed.raw.filter((arg) => !["--dry-run", "--dryRun", "--dryrun"].includes(arg));
|
||||
const nextAction = `hose-use ${confirmedArgs.join(" ")} --yes`;
|
||||
const payload = {
|
||||
dryRun: true,
|
||||
operation,
|
||||
target,
|
||||
changes,
|
||||
nextAction: `hose-use ${parsed.raw.join(" ")} --yes`,
|
||||
nextAction,
|
||||
};
|
||||
|
||||
if (runtime.jsonMode) {
|
||||
@@ -74,7 +76,7 @@ export function mutationPreview(
|
||||
`目标: ${target}`,
|
||||
"变更:",
|
||||
...Object.entries(changes).map(([key, value]) => ` ${key}: ${formatPreviewValue(value)}`),
|
||||
`下一步: hose-use ${parsed.raw.join(" ")} --yes`,
|
||||
`下一步: ${nextAction}`,
|
||||
];
|
||||
return { stdout: `${lines.join("\n")}\n`, stderr: "", exitCode: 0 };
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user