From a89d8482d24b732ed75a1a71f0f266d50ba67c1f Mon Sep 17 00:00:00 2001 From: Chris Wanstrath Date: Tue, 24 Feb 2026 19:07:39 -0800 Subject: [PATCH] Add color and pager support to log command --- src/commands/log.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/commands/log.ts b/src/commands/log.ts index e0424f6..edbe4a5 100644 --- a/src/commands/log.ts +++ b/src/commands/log.ts @@ -1,12 +1,15 @@ import { $ } from "bun" -import { die } from "../fmt.ts" +import { die, yellow, reset, pager } from "../fmt.ts" import { requireSession } from "./helpers.ts" export async function action(branch: string) { const { session } = await requireSession(branch) - const result = await $`git -C ${session.worktree} log main..HEAD`.nothrow() + const result = await $`git -C ${session.worktree} log --no-color main..HEAD`.nothrow().quiet() if (result.exitCode !== 0) { die("git log failed") } + + const output = result.text().replace(/^(commit [0-9a-f]+)/gm, `${yellow}$1${reset}`) + await pager(output) }