Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .changeset/add-run-strict-flag.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
"lingo.dev": minor
---
Add `--strict` mode to stop on the first error.
7 changes: 5 additions & 2 deletions packages/cli/src/cli/cmd/run/execute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export default async function execute(input: CmdRunContext) {

return task.newListr(workerTasks, {
concurrent: true,
exitOnError: false,
exitOnError: !!ctx.flags.strict,
rendererOptions: {
...commonTaskRendererOptions,
collapseSubtasks: true,
Expand All @@ -87,7 +87,7 @@ export default async function execute(input: CmdRunContext) {
},
],
{
exitOnError: false,
exitOnError: !!input.flags.strict,
rendererOptions: commonTaskRendererOptions,
},
).run(input);
Expand Down Expand Up @@ -296,6 +296,9 @@ function createWorkerTask(args: {
targetLocale: assignedTask.targetLocale,
} satisfies CmdRunTaskResult;
} catch (error) {
if (args.ctx.flags.strict) {
throw error;
}
return {
status: "error",
error: error as Error,
Expand Down
4 changes: 4 additions & 0 deletions packages/cli/src/cli/cmd/run/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ export default new Command()
"--sound",
"Play audio feedback when translations complete (success or failure sounds)",
)
.option(
"--strict",
"Stop immediately on first error instead of continuing to process remaining buckets and locales (fail-fast mode)",
)
.action(async (args) => {
let authId: string | null = null;
try {
Expand Down
Loading