From edb7fc460cc13728097d8e205c54c2964f077f06 Mon Sep 17 00:00:00 2001 From: Jacob Bolda Date: Sun, 26 Jul 2026 23:00:27 -0500 Subject: [PATCH 1/2] pass exit code on format command --- .changeset/odd-coats-stick.md | 5 +++++ src/commands/format.ts | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 .changeset/odd-coats-stick.md diff --git a/.changeset/odd-coats-stick.md b/.changeset/odd-coats-stick.md new file mode 100644 index 0000000..ccb2a21 --- /dev/null +++ b/.changeset/odd-coats-stick.md @@ -0,0 +1,5 @@ +--- +"@bomb.sh/tools": patch +--- + +`format` CLI command respects internal format call and passes the exit code to the user. diff --git a/src/commands/format.ts b/src/commands/format.ts index 4e015d5..9269e22 100644 --- a/src/commands/format.ts +++ b/src/commands/format.ts @@ -6,9 +6,10 @@ import { local } from '../utils.ts'; const config = fileURLToPath(new URL('../../oxfmtrc.json', import.meta.url)); export async function format(ctx: CommandContext) { - const stdio = x(local('oxfmt'), ['-c', config, ...ctx.args]); + const result = x(local('oxfmt'), ['-c', config, ...ctx.args]); - for await (const line of stdio) { + for await (const line of result) { console.info(line); } + if (result.exitCode !== 0) process.exit(result.exitCode!); } From 52d6f6055cc56daceaee843be52713e96c8fcb1f Mon Sep 17 00:00:00 2001 From: Jacob Bolda Date: Wed, 29 Jul 2026 16:12:00 -0500 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Roman --- src/commands/format.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/format.ts b/src/commands/format.ts index 9269e22..7cd6baa 100644 --- a/src/commands/format.ts +++ b/src/commands/format.ts @@ -11,5 +11,5 @@ export async function format(ctx: CommandContext) { for await (const line of result) { console.info(line); } - if (result.exitCode !== 0) process.exit(result.exitCode!); + if (result.exitCode) process.exit(result.exitCode); }